List of usage examples for javafx.geometry Insets Insets
public Insets(@NamedArg("topRightBottomLeft") double topRightBottomLeft)
From source file:org.samcrow.frameviewer.ui.db.DatabaseConnectionDialog.java
public DatabaseConnectionDialog(String connectionTypeName) { this.connectionTypeName = connectionTypeName; setTitle("Database connection"); // Placeholder root.getChildren().add(new Region()); // Buttons/*w w w . jav a 2 s. c om*/ { final HBox buttonBox = new HBox(); buttonBox.setPadding(new Insets(10)); cancelButton.setCancelButton(true); buttonBox.getChildren().add(cancelButton); cancelButton.setOnAction((ActionEvent t) -> { hide(); }); final Region spacer = new Region(); buttonBox.getChildren().add(spacer); HBox.setHgrow(spacer, Priority.ALWAYS); nextButton.setDefaultButton(true); buttonBox.getChildren().add(nextButton); root.getChildren().add(buttonBox); } switchToConnection(); final Scene scene = new Scene(root, 220, root.getPrefHeight()); setScene(scene); }
From source file:Person.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle(""); Group root = new Group(); Scene scene = new Scene(root, 500, 250, Color.WHITE); // create a grid pane GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);//w w w. ja v a 2 s . c om gridpane.setVgap(10); ObservableList<Person> leaders = FXCollections.observableArrayList(); leaders.add(new Person("A", "B", "C")); leaders.add(new Person("D", "E", "F")); final ListView<Person> leaderListView = new ListView<Person>(leaders); leaderListView.setPrefWidth(150); leaderListView.setPrefHeight(150); // leaderListView.setCellFactory(new Callback<ListView<Person>, ListCell<Person>>() { public ListCell<Person> call(ListView<Person> param) { final Label leadLbl = new Label(); final Tooltip tooltip = new Tooltip(); final ListCell<Person> cell = new ListCell<Person>() { @Override public void updateItem(Person item, boolean empty) { super.updateItem(item, empty); if (item != null) { leadLbl.setText(item.getAliasName()); setText(item.getFirstName() + " " + item.getLastName()); tooltip.setText(item.getAliasName()); setTooltip(tooltip); } } }; // ListCell return cell; } }); // setCellFactory gridpane.add(leaderListView, 0, 1); leaderListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Person>() { public void changed(ObservableValue<? extends Person> observable, Person oldValue, Person newValue) { System.out.println("selection changed"); } }); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:gndata.app.ui.metadata.manage.AddRDFInstanceCtrl.java
public AddRDFInstanceCtrl(ProjectState projState, MetadataNavState navigationState, Resource extRes) { projectState = projState;//from w w w . j a v a2 s . c o m navState = navigationState; oh = projectState.getMetadata().ontmanager; preSelNewClass = extRes; currInsets = new SimpleObjectProperty<>(new Insets(5)); labelText = new SimpleStringProperty(); newClassesList = FXCollections.observableArrayList(); newClasses = new SimpleObjectProperty<>(); selectedNewClass = new SimpleObjectProperty<>(); newPredicatesList = FXCollections.observableArrayList(); newPredicates = new SimpleObjectProperty<>(); additionalPredicatesList = FXCollections.observableArrayList(); additionalPredicates = new SimpleObjectProperty<>(); selectedPredicate = new SimpleObjectProperty<>(); addPredValue = new SimpleStringProperty(); addPredType = new SimpleObjectProperty<>(); addPredPromptText = new SimpleStringProperty(); // Update the contents of the DataProperty table, if a new class has been selected selectedNewClass.addListener((observable, oldValue, newValue) -> { if (selectedNewClass.get().getValue() != null) { newPredicatesList.clear(); oh.listDatatypeProperties(selectedNewClass.get().getValue()).stream().forEach(c -> { //TODO take care of the case of multiple datatypes Set<RDFDatatype> dts = oh.getRange(c.asDatatypeProperty()); RDFDatatype dt = dts.iterator().next(); newPredicatesList.add(new DataPropertyTableItem(c.asProperty(), dt)); }); } }); // Listen on the selected new predicate and set the corresponding RDF DataType accordingly selectedPredicate.addListener((observable, oldValue, newValue) -> { addPredPromptText.set(""); if (observable != null && newValue != null) { //TODO take care of the case of multiple datatypes Set<RDFDatatype> dts = oh.getRange(observable.getValue()); RDFDatatype dt = dts.iterator().next(); addPredType.set(dt); addPredPromptText .set("Enter " + (dt == null ? "String" : dt.getJavaClass().getSimpleName()) + " value"); } }); // Handle list of additional DataType properties newPredicatesList.addListener((ListChangeListener<DataPropertyTableItem>) change -> { // Reset list of additional DataType properties additionalPredicatesList.clear(); // Get all available datatype properties for selected class oh.listDatatypeProperties(selectedNewClass.get().getValue()).stream() .forEach(c -> additionalPredicatesList.add(c.asDatatypeProperty())); // TODO implement check for DataType Properties which can be added // TODO multiple times // Remove all datatype properties which already exist in the table newPredicatesList.stream().forEach(c -> { if (additionalPredicatesList.contains(c.getProperty())) { additionalPredicatesList.remove(c.getProperty()); } }); }); }
From source file:Main.java
@Override public void start(Stage primaryStage) { final GridPane grid = new GridPane(); grid.setPadding(new Insets(10)); grid.setHgap(10);//from ww w . jav a 2 s. c o m grid.setVgap(5); createControls(grid); createClipList(grid); final Scene scene = new Scene(grid, 640, 380); scene.getStylesheets().add(getClass().getResource("media.css").toString()); primaryStage.setTitle("AudioClip Example"); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
private GridPane createGridPane() { final GridPane gp = new GridPane(); gp.setPadding(new Insets(10)); gp.setHgap(20);/*w ww.ja v a 2 s .c o m*/ //gp.add(albumCover, 0, 0, 1, GridPane.REMAINING); gp.add(title, 1, 0); gp.add(artist, 1, 1); gp.add(album, 1, 2); gp.add(year, 1, 3); final ColumnConstraints c0 = new ColumnConstraints(); final ColumnConstraints c1 = new ColumnConstraints(); c1.setHgrow(Priority.ALWAYS); gp.getColumnConstraints().addAll(c0, c1); final RowConstraints r0 = new RowConstraints(); r0.setValignment(VPos.TOP); gp.getRowConstraints().addAll(r0, r0, r0, r0); return gp; }
From source file:Main.java
@Override public void start(Stage primaryStage) { final Label label = new Label("Progress:"); final ProgressBar progressBar = new ProgressBar(0); final ProgressIndicator progressIndicator = new ProgressIndicator(0); final Button startButton = new Button("Start"); final Button cancelButton = new Button("Cancel"); final TextArea textArea = new TextArea(); startButton.setOnAction((ActionEvent event) -> { startButton.setDisable(true);// www . ja v a 2s . c o m progressBar.setProgress(0); progressIndicator.setProgress(0); textArea.setText(""); cancelButton.setDisable(false); copyWorker = createWorker(numFiles); progressBar.progressProperty().unbind(); progressBar.progressProperty().bind(copyWorker.progressProperty()); progressIndicator.progressProperty().unbind(); progressIndicator.progressProperty().bind(copyWorker.progressProperty()); copyWorker.messageProperty().addListener( (ObservableValue<? extends String> observable, String oldValue, String newValue) -> { textArea.appendText(newValue + "\n"); }); new Thread(copyWorker).start(); }); cancelButton.setOnAction((ActionEvent event) -> { startButton.setDisable(false); cancelButton.setDisable(true); copyWorker.cancel(true); progressBar.progressProperty().unbind(); progressBar.setProgress(0); progressIndicator.progressProperty().unbind(); progressIndicator.setProgress(0); textArea.appendText("File transfer was cancelled."); }); BorderPane root = new BorderPane(); Scene scene = new Scene(root, 500, 250, javafx.scene.paint.Color.WHITE); FlowPane topPane = new FlowPane(5, 5); topPane.setPadding(new Insets(5)); topPane.setAlignment(Pos.CENTER); topPane.getChildren().addAll(label, progressBar, progressIndicator); GridPane middlePane = new GridPane(); middlePane.setPadding(new Insets(5)); middlePane.setHgap(20); middlePane.setVgap(20); ColumnConstraints column1 = new ColumnConstraints(300, 400, Double.MAX_VALUE); middlePane.getColumnConstraints().addAll(column1); middlePane.setAlignment(Pos.CENTER); middlePane.add(textArea, 0, 0); FlowPane bottomPane = new FlowPane(5, 5); bottomPane.setPadding(new Insets(5)); bottomPane.setAlignment(Pos.CENTER); bottomPane.getChildren().addAll(startButton, cancelButton); root.setTop(topPane); root.setCenter(middlePane); root.setBottom(bottomPane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(final Stage stage) { final Node loginPanel = makeDraggable(createLoginPanel()); final Node confirmationPanel = makeDraggable(createConfirmationPanel()); final Node progressPanel = makeDraggable(createProgressPanel()); loginPanel.relocate(0, 0);/*w w w .j a va2 s . c om*/ confirmationPanel.relocate(0, 67); progressPanel.relocate(0, 106); final Pane panelsPane = new Pane(); panelsPane.getChildren().addAll(loginPanel, confirmationPanel, progressPanel); final BorderPane sceneRoot = new BorderPane(); BorderPane.setAlignment(panelsPane, Pos.TOP_LEFT); sceneRoot.setCenter(panelsPane); final CheckBox dragModeCheckbox = new CheckBox("Drag mode"); BorderPane.setMargin(dragModeCheckbox, new Insets(6)); sceneRoot.setBottom(dragModeCheckbox); dragModeActiveProperty.bind(dragModeCheckbox.selectedProperty()); final Scene scene = new Scene(sceneRoot, 400, 300); stage.setScene(scene); stage.setTitle("Draggable Panels Example"); stage.show(); }
From source file:net.thirdy.blackmarket.controls.ModSelectionPane.java
public ModSelectionPane() { setHgap(5.0);/*from w w w. ja va2s . com*/ setMaxHeight(Double.MAX_VALUE); setMinHeight(560); setAlignment(Pos.CENTER); setupModListView(); accept(Collections.emptyList()); setupModMappingTable(); setupFilterTextField(); tfMinShouldMatch = new DoubleTextField("Minimum number of OR modifiers to match"); tfMinShouldMatch.setMinWidth(350); Button add = addButton(); add.setPrefWidth(150); HBox hBox = new HBox(5, new Label("Filter: "), filterField, add); hBox.setAlignment(Pos.CENTER); VBox.setVgrow(modMappingTable, Priority.ALWAYS); VBox left = new VBox(10, hBox, modMappingTable); VBox.setVgrow(modsListView, Priority.ALWAYS); Label modifiersLbl = new Label("Modifiers"); modifiersLbl.setFont(Font.font("Verdana", FontWeight.MEDIUM, 14)); modifiersLbl.setPadding(new Insets(4)); HBox minShouldMatchHBox = new HBox(3, new Label("Minimum OR Matches:"), tfMinShouldMatch); minShouldMatchHBox.setAlignment(Pos.CENTER); VBox right = new VBox(3, new StackPane(modifiersLbl), minShouldMatchHBox, modsListView); setupGridPaneColumns(); GridPane.setVgrow(left, Priority.ALWAYS); GridPane.setVgrow(right, Priority.ALWAYS); add(left, 0, 0); add(right, 1, 0); }
From source file:Main.java
private void buildGUI() { rootPane.setPadding(new Insets(10)); rootPane.setPrefHeight(30);//from ww w . j a v a 2s . co m rootPane.setPrefWidth(100); rootPane.setVgap(10); rootPane.setHgap(20); Label playersLabel = new Label("Players"); Label teamLabel = new Label("Team"); rootPane.add(playersLabel, 0, 0); rootPane.add(leftListView, 0, 1); rootPane.add(teamLabel, 1, 0); rootPane.add(rightListView, 1, 1); }
From source file:org.openwms.client.fx.core.view.CustomerDataScreen.java
@SuppressWarnings("unchecked") private Node createDataTable() { StackPane dataTableBorder = new StackPane(); dataTableBorder.getChildren().add(tableView); dataTableBorder.setPadding(new Insets(8)); dataTableBorder.setStyle("-fx-background-color: lightgray"); tableView.setItems(controller.getCustomers()); tableView.getColumns().setAll(TableColumnBuilder.<Customer, String>create().text("First Name") .cellValueFactory(new PropertyValueFactory<Customer, String>("firstName")).prefWidth(204).build(), TableColumnBuilder.<Customer, String>create().text("Last Name") .cellValueFactory(new PropertyValueFactory<Customer, String>("lastName")).prefWidth(204) .build(),/* www . ja va 2 s . c o m*/ TableColumnBuilder.<Customer, String>create().text("Sign-up Date") .cellValueFactory(new PropertyValueFactory<Customer, String>("signupDate")).prefWidth(351) .build()); tableView.setPrefHeight(500); return dataTableBorder; }