This discussion is archived
5 Replies Latest reply: Mar 7, 2013 6:43 AM by James_D RSS

USER INTERFACE IN FXML with some automatic row insertion

tanvir ahmed Newbie
Currently Being Moderated
Dears!

Pls answer that

I want to create a data entry from which contains a row with 5 columns like this

sr# partyCode partyName particulars amount

Now I want that when i enters values in this row and press enter key then a new row is created automatically and I want sr# value to start from 01 and increase automatically too after every enter key pressing.

Pls help

BR

TANVIR
  • 1. Re: USER INTERFACE IN FXML with some automatic row insertion
    James_D Guru
    Currently Being Moderated
    tanvir ahmed wrote:
    Dears!

    Pls answer that

    I want to create a data entry from which contains a row with 5 columns like this

    sr# partyCode partyName particulars amount
    You probably want to use a GridPane for this, with one row of Labels for the headers and rows of TextFields below. There's a [url http://docs.oracle.com/javafx/2/layout/builtin_layouts.htm]tutorial for the layout panes.
    Now I want that when i enters values in this row and press enter key then a new row is created automatically and I want sr# value to start from 01 and increase automatically too after every enter key pressing.
    Just create a controller (see [url http://docs.oracle.com/javafx/2/fxml_get_started/fxml_tutorial_intermediate.htm]this part of the tutorial) and register the appropriate listeners ([url http://docs.oracle.com/javafx/2/events/convenience_methods.htm]tutorial) with your text fields to add new items to the grid pane as necessary.
  • 2. Re: USER INTERFACE IN FXML with some automatic row insertion
    tanvir ahmed Newbie
    Currently Being Moderated
    Sir James !

    Thanks for your reply.

    You understand my question exactly right.

    But I forget to tell that i want to get this all with scene builder, where I am confused that how to create next row in gridPane automatically.

    Regards
  • 3. Re: USER INTERFACE IN FXML with some automatic row insertion
    993317 Newbie
    Currently Being Moderated
    Select the GridPane and go to "Layout" on the right side of Scene Buider, you should see the options of adding rows/columns.
  • 4. Re: USER INTERFACE IN FXML with some automatic row insertion
    tanvir ahmed Newbie
    Currently Being Moderated
    Dear thanks for your reply!

    But I dont find any option for automtic adding of rows in gridPane
  • 5. Re: USER INTERFACE IN FXML with some automatic row insertion
    James_D Guru
    Currently Being Moderated
    SceneBuilder is a tool for generating FXML.

    FXML can only define a static user interface. Code to change the user interface in response to user input, which is what I assume you mean by "automatic row insertion", must be written in another language (not FXML); this is typically Java code and is placed in the controller. (It's possible to do this using other JVM languages, such as Groovy, but Java is by far the most common.)

    So you need to write a controller. Use SceneBuilder to map the fxml file to a controller, and put the code to add new rows into the controller.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points