Java Reference
In-Depth Information
When the form designer application is launched, the grid property control panel is
shown on the left side of the window's split pane. The property control panel allows
the users to manipulate the target form's grid pane attributes dynamically. The follow-
ing code represents the grid property control panel that will manipulate a target grid
pane's properties:
/** GridPaneControlPanel represents the left area of the
split pane
* allowing the user to manipulate the GridPane on the
right.
*
* Manipulating Layout Via Grids
* @author cdea
*/
public class GridPaneControlPanel extends GridPane{
public GridPaneControlPanel(final GridPane
targetGridPane) {
super();
setPadding(new Insets(5));
setHgap(5);
setVgap(5);
// Setting Grid lines
Label gridLinesLbl = new Label("Grid Lines");
final ToggleButton gridLinesToggle = new
ToggleButton("Off");
gridLinesToggle.selectedProperty().addListener((ObservableValue<?
extends Boolean> ov,
Boolean oldValue, Boolean newVal) -> {
targetGridPane.setGridLinesVisible(newVal);
gridLinesToggle.setText(newVal ? "On"
: "Off");
});
// toggle grid lines label
GridPane.setHalignment(gridLinesLbl, HPos.RIGHT);
add(gridLinesLbl, 0, 0);
Search WWH ::




Custom Search