Refine search
public void start(Stage primaryStage) { BorderPane root = new BorderPane(); Label label = new Label("Some\ntext"); label.setGraphic(new ImageView(getClass().getResource("/images/Folder-icon.png").toExternalForm())); label.setMaxWidth(Double.POSITIVE_INFINITY); label.textAlignmentProperty().bind(textAlignmentBox.valueProperty()); GridPane ctrls = new GridPane(); ctrls.setHgap(5); ctrls.setVgap(5); ctrls.setPadding(new Insets(10)); ctrls.addRow(0, new Label("Content display:"), new Label("Alignment:"), new Label("Text Alignment:")); ctrls.addRow(1, contentDisplayBox, alignmentBox, textAlignmentBox); primaryStage.setScene(scene); primaryStage.show();
TextField firstNameFld = new TextField(); firstNameFld.setPrefColumnCount(8); TextField lastNameFld = new TextField(); lastNameFld.setPrefColumnCount(8); GridPane grid = new GridPane(); grid.addRow(0, new Label("First Name:"), firstNameFld); grid.addRow(1, new Label("Last Name:"), lastNameFld); tp1.setContent(grid); tp2.setContent(new Label("tp2.............")); tp3.setContent(new Label("tp3.............."));
@Override public void start(Stage primaryStage) { Text text00 = new Text("text"); Text text01 = new Text("text"); Text text02 = new Text("text"); Text text10 = new Text("text"); Text text11 = new Text("text"); Text text12 = new Text("text"); GridPane gridPane = new GridPane(); ColumnConstraints cConstraints = new ColumnConstraints(); cConstraints.setHalignment(HPos.LEFT); cConstraints.setHgrow(Priority.ALWAYS); gridPane.getColumnConstraints().addAll(cConstraints, cConstraints); gridPane.addColumn(0, text00, text01, text02); gridPane.addColumn(1, text10, text11, text12); GridPane.setHalignment(text11, HPos.CENTER); GridPane.setHalignment(text01, HPos.CENTER); Scene scene = new Scene(gridPane); primaryStage.setScene(scene); primaryStage.show(); }
public class HelloWorld extends Application { @Override public void start(Stage primaryStage) { primaryStage.setTitle("JavaFX Welcome"); // Put here all of that 'homeless' code, starting with GridPane grid = new GridPane(); // ... // Last instruction of the 'homeless' code, you can use a lambda btn.setOnAction(e -> { actiontarget.setFill(Color.FIREBRICK); actiontarget.setText("Sign in button pressed"); }); primaryStage.show(); } }
Canvas canvas = new Canvas(); canvas.setHeight(300); canvas.setWidth(300); ScrollBar vScroll = createScrollBar(Orientation.VERTICAL, 10000, 300); ScrollBar hScroll = createScrollBar(Orientation.HORIZONTAL, 10000, 300); GridPane scrollPane = new GridPane(); scrollPane.addColumn(0, canvas, hScroll); scrollPane.add(vScroll, 1, 0);
ValidationDemo.class.getResource("context.css") .toExternalForm()); stage.setScene(scene); stage.show(); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.add(scenetitle, 0, 0, 2, 1); Label userName = new Label("User Name:"); grid.add(userName, 0, 1); grid.add(userTextField, 1, 1); Label pw = new Label("Password:"); grid.add(pw, 0, 2);
@Override public void start( final Stage primaryStage ) { ColumnConstraints col1 = new ColumnConstraints(); col1.setHgrow( Priority.ALWAYS ); ColumnConstraints col2 = new ColumnConstraints(); col2.setHgrow( Priority.ALWAYS ); GridPane gridPane = new GridPane(); gridPane.setGridLinesVisible( true ); gridPane.getColumnConstraints().addAll( new ColumnConstraints( 60 ), col1, new ColumnConstraints( 100 ), col2 ); gridPane.addColumn( 0, new Button( "col 1" ) ); gridPane.addColumn( 1, new Button( "col 2" ) ); gridPane.addColumn( 2, new Button( "col 3" ) ); gridPane.addColumn( 3, new Button( "col 4" ) ); final Scene scene = new Scene( new VBox( gridPane ), 400, 300 ); primaryStage.setScene( scene ); primaryStage.show(); }
pane.getButtonTypes().addAll(ButtonType.CANCEL, authButtonType); final GridPane grid = new GridPane(); grid.setHgap(10); grid.setVgap(10); password.setPromptText("Password"); grid.add(new Label("Username:"), 0, 0); grid.add(username, 1, 0); grid.add(new Label("Password:"), 0, 1); grid.add(password, 1, 1);
import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.Slider; import javafx.scene.layout.GridPane; import javafx.scene.layout.Priority; import javafx.stage.Stage; public class SliderInGridPane extends Application { @Override public void start(Stage primaryStage) { GridPane root = new GridPane(); root.add(new Label("Value:"), 0, 0); Slider slider = new Slider(0, 100, 50); GridPane.setHgrow(slider, Priority.ALWAYS); root.add(slider, 1, 0); primaryStage.setScene(new Scene(root, 250, 75)); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
ObservableList<Integer> observableList = FXCollections.observableList(Arrays.asList(312, 23, 241)); GridPane gridpane = new GridPane(); gridpane.add(new Label("Item Listing"), 0, 0); for (int i = 0, size = observableList.size(); i < size; i++) { Label l = new Label(); // bind text to content at list position l.textProperty().bind(Bindings.valueAt(observableList, i).asString()); gridpane.add(l, 0, i + 1); }
GridPane root = new GridPane(); for (int x = 0 ; x < 8; x++) { for (int y = 0 ; y < 8 ; y++) { Label label = new Label(String.format("Cell [%d, %d]", x, y)); root.getChildren().add(label); label.getProperties().put("gridpane-column", new Integer(x)); label.getProperties().put("gridpane-row", new Integer(y)); } }
@Override public void start(Stage primaryStage) throws Exception { GridPane grid = new GridPane(); CheckBox box1 = new CheckBox("horse"); box1.setMinWidth(200); box1.setAlignment(Pos.CENTER_RIGHT); grid.getChildren().add(box1); CheckBox box2 = new CheckBox("banana"); grid.getChildren().add(box2); GridPane.setRowIndex(box2, 1); GridPane.setHalignment(box2, HPos.RIGHT); // <=== this is probably what you want primaryStage.setScene(new Scene(grid)); primaryStage.show(); }
add(helpIcon(i18n.i18n("Set the module to open at application startup (restart needed)")), 2, 1); GridPane statsPane = new GridPane(); statsPane.add(clearStatsButton, 0, 0); statsPane.add( helpIcon(i18n .i18n("Usage statistics are used to populate the modules quick bar on the left with the most used and most recently used modules.")),