Java Reference
In-Depth Information
ous properties onto the target form ( GridPane ). This designer application is basically
broken into three classes: ManipulatingLayoutViaGrids , MyForm , and
GridPaneControlPanel . The ManipulatingLayoutViaGrids class is the
main application to be launched. MyForm is the target form that will be manipulated,
and GridPaneControlPanel is the grid property control panel that has UI con-
trols bound to the targets form's grid pane properties.
Begin by creating the main launching point for the application ( Manipulat-
ingLayoutViaGrids ). This class is responsible for creating a split pane
( SplitPane ) that sets up the target form to the right and instantiates a
GridPaneControlPanel to be displayed to the left. To instantiate a
GridPaneControlPanel you must pass in the target form you want to manipulate
into the constructor. I will discuss this further, but suffice it to say that the
GridPaneControlPanel constructor will wire its controls to properties on the tar-
get form.
Next, you create a dummy form called MyForm . This is your target form that the
property control panel will manipulate. Here, notice that the MyForm extends
GridPane . In the MyForm 's constructor, you create and add controls to be put into
the form ( GridPane ).
To learn more about the GridPane , refer to Recipe 15-8. The following code is a
target form to be manipulated by the form designer application:
/**
* MyForm is a form to be manipulated by the user.
* @author cdea
*/
public class MyForm extends GridPane{
public MyForm() {
setPadding(new Insets(5));
setHgap(5);
setVgap(5);
Label fNameLbl = new Label("First Name");
TextField fNameFld = new TextField();
Label lNameLbl = new Label("Last Name");
TextField lNameFld = new TextField();
Label ageLbl = new Label("Age");
Search WWH ::




Custom Search