List of usage examples for javafx.scene.layout GridPane setVgrow
public static void setVgrow(Node child, Priority value)
From source file:de.pixida.logtest.designer.commons.ExceptionDialog.java
public static void showFatalException(final String title, final String message, final Throwable exception) { final Alert alert = new Alert(Alert.AlertType.ERROR); alert.initStyle(StageStyle.UTILITY); alert.setTitle("Error"); alert.setHeaderText(title);/*w w w.jav a2 s . co m*/ alert.setContentText(message); final Label label = new Label("Details:"); final TextArea textArea = new TextArea(ExceptionUtils.getStackTrace(exception)); textArea.setEditable(false); textArea.setWrapText(true); textArea.setMaxWidth(Double.MAX_VALUE); textArea.setMaxHeight(Double.MAX_VALUE); GridPane.setVgrow(textArea, Priority.ALWAYS); GridPane.setHgrow(textArea, Priority.ALWAYS); final GridPane expContent = new GridPane(); expContent.setMaxWidth(Double.MAX_VALUE); expContent.add(label, 0, 0); expContent.add(textArea, 0, 1); alert.getDialogPane().setExpandableContent(expContent); alert.showAndWait(); }
From source file:org.mskcc.shenkers.control.alignment.AlignmentOverlay.java
private void populateGridPane() { ObservableList<Node> children = this.getChildren(); children.clear();//w w w. j a v a 2 s . c o m int l = nodes.size(); boolean flip = flipProperty.get(); for (int i = 0; i < l; i++) { Node n = nodes.get(i); GridPane.setHalignment(n, HPos.CENTER); GridPane.setValignment(n, VPos.CENTER); GridPane.setHgrow(n, Priority.ALWAYS); GridPane.setVgrow(n, Priority.ALWAYS); GridPane.setRowIndex(n, 0); GridPane.setColumnIndex(n, flip ? l - i - 1 : i); children.add(n); } }
From source file:org.blockedit.utils.ExceptionDialog.java
/** * Create a exception alert that is displayed to the user. * * @param message The message to show the user * @param title The title of the window//from w w w . j ava 2 s . co m * @param header The message header * @param exception The exception that triggered this window to be displayed to the user * @return A created alert */ private static Alert createDialog(String message, String title, String header, Exception exception) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle(title); alert.setHeaderText(header); alert.setContentText(message); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); String exceptionText = ExceptionUtils.getStackTrace(exception); exception.printStackTrace(); Label label = new Label("The exception stacktrace was:"); TextArea exceptionArea = new TextArea( exceptionText + "\n\n==User Information==\njava.version = " + System.getProperty("java.version") + "\nos.name = " + System.getProperty("os.name") + "\nos.arch = " + System.getProperty("os.arch") + "\nos.version = " + System.getProperty("os.version")); exceptionArea.setEditable(false); exceptionArea.setWrapText(true); exceptionArea.setMaxWidth(UserInformation.getWindowWidth() / 2); exceptionArea.setMaxHeight(UserInformation.getWindowHeight() / 2); GridPane.setVgrow(exceptionArea, Priority.ALWAYS); GridPane.setHgrow(exceptionArea, Priority.ALWAYS); GridPane expContent = new GridPane(); expContent.setMaxWidth(UserInformation.getWindowWidth() / 2); expContent.add(label, 0, 0); expContent.add(exceptionArea, 0, 1); alert.getDialogPane().setExpandableContent(expContent); return alert; }
From source file:Main.java
@Override public void start(Stage primaryStage) { BorderPane root = new BorderPane(); Scene scene = new Scene(root, 400, 250, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);// w w w .ja va 2 s . c om gridpane.setVgap(10); ColumnConstraints column1 = new ColumnConstraints(150, 150, Double.MAX_VALUE); ColumnConstraints column2 = new ColumnConstraints(50); ColumnConstraints column3 = new ColumnConstraints(150, 150, Double.MAX_VALUE); column1.setHgrow(Priority.ALWAYS); column3.setHgrow(Priority.ALWAYS); gridpane.getColumnConstraints().addAll(column1, column2, column3); Label candidatesLbl = new Label("Candidates"); GridPane.setHalignment(candidatesLbl, HPos.CENTER); gridpane.add(candidatesLbl, 0, 0); Label selectedLbl = new Label("selected"); gridpane.add(selectedLbl, 2, 0); GridPane.setHalignment(selectedLbl, HPos.CENTER); // Candidates final ObservableList<String> candidates = FXCollections.observableArrayList("Z", "A", "B", "C", "D"); final ListView<String> candidatesListView = new ListView<>(candidates); gridpane.add(candidatesListView, 0, 1); final ObservableList<String> selected = FXCollections.observableArrayList(); final ListView<String> heroListView = new ListView<>(selected); gridpane.add(heroListView, 2, 1); Button sendRightButton = new Button(" > "); sendRightButton.setOnAction((ActionEvent event) -> { String potential = candidatesListView.getSelectionModel().getSelectedItem(); if (potential != null) { candidatesListView.getSelectionModel().clearSelection(); candidates.remove(potential); selected.add(potential); } }); Button sendLeftButton = new Button(" < "); sendLeftButton.setOnAction((ActionEvent event) -> { String s = heroListView.getSelectionModel().getSelectedItem(); if (s != null) { heroListView.getSelectionModel().clearSelection(); selected.remove(s); candidates.add(s); } }); VBox vbox = new VBox(5); vbox.getChildren().addAll(sendRightButton, sendLeftButton); gridpane.add(vbox, 1, 1); root.setCenter(gridpane); GridPane.setVgrow(root, Priority.ALWAYS); primaryStage.setScene(scene); primaryStage.show(); }
From source file:com.canoo.dolphin.todo.client.ToDoClient.java
private void showError(String header, String content, Exception e) { e.printStackTrace();//from w w w .j a va2 s . co m Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Error"); alert.setHeaderText(header); alert.setContentText(content); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); String exceptionText = sw.toString(); Label label = new Label("The exception stacktrace was:"); TextArea textArea = new TextArea(exceptionText); textArea.setEditable(false); textArea.setWrapText(true); textArea.setMaxWidth(Double.MAX_VALUE); textArea.setMaxHeight(Double.MAX_VALUE); GridPane.setVgrow(textArea, Priority.ALWAYS); GridPane.setHgrow(textArea, Priority.ALWAYS); GridPane expContent = new GridPane(); expContent.setMaxWidth(Double.MAX_VALUE); expContent.add(label, 0, 0); expContent.add(textArea, 0, 1); alert.getDialogPane().setExpandableContent(expContent); alert.showAndWait(); System.exit(-1); }
From source file:Main.java
@Override public void start(Stage primaryStage) { BorderPane root = new BorderPane(); Scene scene = new Scene(root, 400, 250, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);/*from ww w . jav a2 s.com*/ gridpane.setVgap(10); ColumnConstraints column1 = new ColumnConstraints(150, 150, Double.MAX_VALUE); ColumnConstraints column2 = new ColumnConstraints(50); ColumnConstraints column3 = new ColumnConstraints(150, 150, Double.MAX_VALUE); column1.setHgrow(Priority.ALWAYS); column3.setHgrow(Priority.ALWAYS); gridpane.getColumnConstraints().addAll(column1, column2, column3); // Candidates label Label candidatesLbl = new Label("Candidates"); GridPane.setHalignment(candidatesLbl, HPos.CENTER); gridpane.add(candidatesLbl, 0, 0); // Heroes label Label heroesLbl = new Label("Letters"); gridpane.add(heroesLbl, 2, 0); GridPane.setHalignment(heroesLbl, HPos.CENTER); final ObservableList<String> candidates = FXCollections.observableArrayList("A", "B", "C", "D"); final ListView<String> candidatesListView = new ListView<>(candidates); gridpane.add(candidatesListView, 0, 1); final ObservableList<String> heroes = FXCollections.observableArrayList(); final ListView<String> heroListView = new ListView<>(heroes); gridpane.add(heroListView, 2, 1); Button sendRightButton = new Button(" > "); sendRightButton.setOnAction((ActionEvent event) -> { String potential = candidatesListView.getSelectionModel().getSelectedItem(); if (potential != null) { candidatesListView.getSelectionModel().clearSelection(); candidates.remove(potential); heroes.add(potential); } }); Button sendLeftButton = new Button(" < "); sendLeftButton.setOnAction((ActionEvent event) -> { String notHero = heroListView.getSelectionModel().getSelectedItem(); if (notHero != null) { heroListView.getSelectionModel().clearSelection(); heroes.remove(notHero); candidates.add(notHero); } }); // place the buttons VBox vbox = new VBox(5); vbox.setAlignment(Pos.CENTER); vbox.getChildren().addAll(sendRightButton, sendLeftButton); GridPane.setHalignment(vbox, HPos.CENTER); gridpane.add(vbox, 1, 1); // place the grid root.setCenter(gridpane); GridPane.setVgrow(root, Priority.ALWAYS); primaryStage.setScene(scene); primaryStage.show(); }
From source file:org.jacp.demo.components.ContactChartViewComponent.java
private GridPane createRoot() { final GridPane myRoot = new GridPane(); myRoot.getStyleClass().addAll("dark", "bar-chart-root"); myRoot.setAlignment(Pos.CENTER);//from w w w .j av a2s. c om GridPane.setHgrow(myRoot, Priority.ALWAYS); GridPane.setVgrow(myRoot, Priority.ALWAYS); return myRoot; }
From source file:net.thirdy.blackmarket.controls.ModSelectionPane.java
public ModSelectionPane() { setHgap(5.0);/* ww w.ja v a 2 s . 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:org.jacp.demo.components.ContactChartViewComponent.java
protected BarChart<String, Number> createChart() { this.xAxis = new CategoryAxis(); this.yAxis = new NumberAxis(); this.yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(this.yAxis, "$", null)); this.bc = new BarChart<String, Number>(this.xAxis, this.yAxis); this.bc.setAnimated(true); this.bc.setTitle(" "); this.xAxis.getStyleClass().add("jacp-bar"); this.yAxis.getStyleClass().add("jacp-bar"); this.xAxis.setLabel("Year"); this.yAxis.setLabel("Price"); this.series1 = new XYChart.Series<String, Number>(); this.series1.setName("electronic"); this.series2 = new XYChart.Series<String, Number>(); this.series2.setName("clothes"); this.series3 = new XYChart.Series<String, Number>(); this.series3.setName("hardware"); this.series4 = new XYChart.Series<String, Number>(); this.series4.setName("books"); GridPane.setHalignment(this.bc, HPos.CENTER); GridPane.setVgrow(this.bc, Priority.ALWAYS); GridPane.setHgrow(this.bc, Priority.ALWAYS); GridPane.setMargin(this.bc, new Insets(0, 6, 0, 0)); return this.bc; }
From source file:Main.java
private void createClipList(GridPane grid) { final VBox vbox = new VBox(30); vbox.setAlignment(Pos.TOP_CENTER);/* w w w.ja va 2 s . c om*/ final Label clipLabel = new Label("Code Monkey To-Do List:"); clipLabel.setId("clipLabel"); final Button getUpButton = new Button("Get Up, Get Coffee"); getUpButton.setPrefWidth(300); getUpButton.setOnAction(createPlayHandler(coffeeClip)); final Button goToJobButton = new Button("Go to Job"); goToJobButton.setPrefWidth(300); goToJobButton.setOnAction(createPlayHandler(jobClip)); final Button meetingButton = new Button("Have Boring Meeting"); meetingButton.setPrefWidth(300); meetingButton.setOnAction(createPlayHandler(meetingClip)); final Hyperlink link = new Hyperlink("About Code Monkey..."); link.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { WebView wv = new WebView(); wv.getEngine().load("http://www.jonathancoulton.com/2006/04/14/" + "thing-a-week-29-code-monkey/"); Scene scene = new Scene(wv, 720, 480); Stage stage = new Stage(); stage.setTitle("Code Monkey"); stage.setScene(scene); stage.show(); } }); vbox.getChildren().addAll(clipLabel, getUpButton, goToJobButton, meetingButton, link); GridPane.setHalignment(vbox, HPos.CENTER); GridPane.setHgrow(vbox, Priority.ALWAYS); GridPane.setVgrow(vbox, Priority.ALWAYS); grid.add(vbox, 0, 0, GridPane.REMAINING, 1); }