List of usage examples for javafx.scene.layout VBox VBox
public VBox()
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(250);/*from w ww . j ava2 s . c o m*/ stage.setHeight(150); final ToggleGroup group = new ToggleGroup(); RadioButton rb1 = new RadioButton("A"); rb1.setToggleGroup(group); rb1.setUserData("A"); RadioButton rb2 = new RadioButton("B"); rb2.setToggleGroup(group); rb2.setUserData("B"); RadioButton rb3 = new RadioButton("C"); rb3.setToggleGroup(group); rb3.setUserData("C"); group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() { public void changed(ObservableValue<? extends Toggle> ov, Toggle old_toggle, Toggle new_toggle) { if (group.getSelectedToggle() != null) { System.out.println(group.getSelectedToggle().getUserData().toString()); } } }); HBox hbox = new HBox(); VBox vbox = new VBox(); vbox.getChildren().add(rb1); vbox.getChildren().add(rb2); vbox.getChildren().add(rb3); vbox.setSpacing(10); hbox.getChildren().add(vbox); hbox.setSpacing(50); hbox.setPadding(new Insets(20, 10, 10, 20)); ((Group) scene.getRoot()).getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:investor.views.CompaniesView.java
public void InitView() { selectedRange = DataRange.THREEMONTH; selectedChart = "line"; pane = new VBox(); lineChart = LinearChartManager.linear(); lineChart.setTitle(""); table = new TableView(); try {// www .j a v a 2s.c om table.getItems().addAll(NetworkManager.show(DataType.SPOL)); } catch (Exception e) { System.out.println("Something went wrong when populating market indicisies view"); } table.getColumns().addAll(initColumns()); table.setRowFactory(tv -> { TableRow<Index> row = new TableRow<Index>(); row.setOnMouseClicked(event -> { if (event.getClickCount() == 2 && (!row.isEmpty())) { Index rowData = row.getItem(); selectedIndex = rowData; //System.out.println(rowData); try { lastData = NetworkManager.showMore(rowData.getSymbol(), selectedRange); System.out.println(lastData.length); if (selectedChart.equals("line")) { lineChart.getData().clear(); lineChart.setTitle(rowData.getName()); LinearChartManager.addSeries(lineChart, lastData, selectedRange); if (pointerType != null && pointerType != "hide") { OnPointerChange(); } } else { CandleChart.generateData(lastData); candleChart = new CandleChart(); CandleChart.CandleStickChart chart = candleChart.createChart(); chart.setTitle(rowData.getName()); pane.getStylesheets().add("resources/css/CandleStickChart.css"); borderPane.setCenter(chart); } } catch (Exception ex) { System.out.println("Error while downloading indicise " + ex.toString()); } } }); return row; }); //table.setItems(initRows()); table.setEditable(false); VBox vBox = (VBox) pane; borderPane = new BorderPane(); borderPane.setCenter(lineChart); borderPane.setRight(addMenuButtons()); vBox.getChildren().add(table); vBox.getChildren().add(borderPane); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Radio Button Sample"); stage.setWidth(250);//from w w w . ja va 2 s .c o m stage.setHeight(150); final ToggleGroup group = new ToggleGroup(); RadioButton rb1 = new RadioButton("A"); rb1.setToggleGroup(group); rb1.setUserData("A"); RadioButton rb2 = new RadioButton("B"); rb2.setToggleGroup(group); rb2.setUserData("B"); RadioButton rb3 = new RadioButton("C"); rb3.setToggleGroup(group); rb3.setUserData("C"); group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() { public void changed(ObservableValue<? extends Toggle> ov, Toggle old_toggle, Toggle new_toggle) { if (group.getSelectedToggle() != null) { System.out.println(group.getSelectedToggle().getUserData().toString()); } } }); HBox hbox = new HBox(); VBox vbox = new VBox(); vbox.getChildren().add(rb1); vbox.getChildren().add(rb2); vbox.getChildren().add(rb3); vbox.setSpacing(10); hbox.getChildren().add(vbox); hbox.setSpacing(50); hbox.setPadding(new Insets(20, 10, 10, 20)); ((Group) scene.getRoot()).getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(450);//from ww w. ja va 2 s . c o m stage.setHeight(550); TableColumn firstNameCol = new TableColumn("First Name"); firstNameCol.setMinWidth(100); firstNameCol.setCellValueFactory(new PropertyValueFactory<>("firstName")); TableColumn lastNameCol = new TableColumn("Last Name"); lastNameCol.setMinWidth(100); lastNameCol.setCellValueFactory(new PropertyValueFactory<>("lastName")); table.setItems(data); table.getColumns().addAll(firstNameCol, lastNameCol); firstNameCol.setSortType(TableColumn.SortType.DESCENDING); lastNameCol.setSortable(false); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(table); ((Group) scene.getRoot()).getChildren().addAll(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { rootNode.setExpanded(true);/* www . j a v a 2s . c o m*/ for (Employee employee : employees) { TreeItem<String> empLeaf = new TreeItem<String>(employee.getName()); boolean found = false; for (TreeItem<String> depNode : rootNode.getChildren()) { if (depNode.getValue().contentEquals(employee.getDepartment())) { depNode.getChildren().add(empLeaf); found = true; break; } } if (!found) { TreeItem depNode = new TreeItem(employee.getDepartment()); rootNode.getChildren().add(depNode); depNode.getChildren().add(empLeaf); } } stage.setTitle("Tree View Sample"); VBox box = new VBox(); final Scene scene = new Scene(box, 400, 300); scene.setFill(Color.LIGHTGRAY); TreeView<String> treeView = new TreeView<String>(rootNode); treeView.setShowRoot(true); treeView.setEditable(true); box.getChildren().add(treeView); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(450);/*from ww w. j ava 2 s . co m*/ stage.setHeight(550); TableColumn firstNameCol = new TableColumn("First Name"); firstNameCol.setMinWidth(100); firstNameCol.setCellValueFactory(new PropertyValueFactory<>("firstName")); TableColumn lastNameCol = new TableColumn("Last Name"); lastNameCol.setMinWidth(100); lastNameCol.setCellValueFactory(new PropertyValueFactory<>("lastName")); table.setItems(data); table.getColumns().addAll(firstNameCol, lastNameCol); final Button addButton = new Button("Add"); addButton.setOnAction((ActionEvent e) -> { data.add(new Person("Z", "X")); }); hb.getChildren().addAll(addButton); hb.setSpacing(3); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(table, hb); ((Group) scene.getRoot()).getChildren().addAll(vbox); stage.setScene(scene); stage.show(); }
From source file:clientechat.TestList.java
@Override public void start(Stage primaryStage) { WebView wv = new WebView(); Button btn = new Button(); TextField textField = new TextField(); VBox vb = new VBox(); WebEngine appendEngine = wv.getEngine(); btn.setOnAction(new EventHandler<ActionEvent>() { @Override/*from w w w. j a v a 2s. c o m*/ public void handle(ActionEvent event) { executejQuery(appendEngine, "$('#content').append(\"<p align=right><b>World!" + escapeHtml(textField.getText()) + "<b><p>\");"); executejQuery(appendEngine, "$(\"html, body\").animate({ scrollTop: $(document).height()-$(window).height() });"); } }); wv.getEngine().loadContent( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" + "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" + "<head>\n" + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n" + "<title>Documento sin ttulo</title>\n" + "</head>\n" + "\n" + "<body id=\"content\">\n" + " \n" + "</body>\n" + "</html>"); vb.getChildren().addAll(wv, btn, textField); Scene scene = new Scene(vb); primaryStage.setTitle("Hello World!"); primaryStage.setScene(scene); primaryStage.show(); }
From source file:org.noroomattheinn.visibletesla.dialogs.VersionUpdater.java
public static boolean checkForNewerVersion(String thisVersion, Stage stage, final HostServices svcs, boolean experimentalOK) { final Versions versions = Versions.getVersionInfo(VersionsFile); if (versions == null) return false; // Missing, empty, or corrupt versions file List<Release> releases = versions.getReleases(); if (releases != null && !releases.isEmpty()) { Release lastRelease = null;//from ww w. j a va2 s. com for (Release cur : releases) { if (cur.getInvisible()) continue; if (cur.getExperimental() && !experimentalOK) continue; lastRelease = cur; break; } if (lastRelease == null) return false; String releaseNumber = lastRelease.getReleaseNumber(); if (Utils.compareVersions(thisVersion, releaseNumber) < 0) { VBox customPane = new VBox(); String msgText = String.format( "A newer version of VisibleTesla is available:\n" + "Version: %s, Date: %tD", releaseNumber, lastRelease.getReleaseDate()); Label msg = new Label(msgText); Hyperlink platformLink = null; final URL platformURL; final String linkText; if (SystemUtils.IS_OS_MAC) { linkText = "Download the latest Mac version"; platformURL = lastRelease.getMacURL(); } else if (SystemUtils.IS_OS_WINDOWS) { linkText = "Download the latest Windows version"; platformURL = lastRelease.getWindowsURL(); } else { linkText = "Download the latest Generic version"; platformURL = lastRelease.getReleaseURL(); } if (platformURL != null) { platformLink = new Hyperlink(linkText); platformLink.setStyle("-fx-color: blue; -fx-text-fill: blue;"); platformLink.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { svcs.showDocument(platformURL.toExternalForm()); } }); } Hyperlink rnLink = new Hyperlink("Click to view the release notes"); rnLink.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { svcs.showDocument(versions.getReleaseNotes().toExternalForm()); } }); customPane.getChildren().addAll(msg, rnLink); customPane.getChildren().add(platformLink); Dialogs.showCustomDialog(stage, customPane, "Newer Version Available", "Checking for Updates", Dialogs.DialogOptions.OK, null); return true; } } return false; }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(400);/*w ww .j a v a 2 s . c om*/ stage.setHeight(550); table.setEditable(true); TableColumn firstNameCol = new TableColumn("First Name"); firstNameCol.setCellValueFactory(new PropertyValueFactory<Person, String>("firstName")); TableColumn lastNameCol = new TableColumn("Last Name"); lastNameCol.setCellValueFactory(new PropertyValueFactory<Person, String>("lastName")); TableColumn emailCol = new TableColumn("Email"); emailCol.setMinWidth(200); emailCol.setCellValueFactory(new PropertyValueFactory<Person, String>("email")); table.setItems(data); table.getColumns().addAll(firstNameCol, lastNameCol, emailCol); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(table); ((Group) scene.getRoot()).getChildren().addAll(vbox); stage.setScene(scene); stage.show(); }
From source file:musicmetadatak1009705.FolderTreeView.java
public VBox treeStack() throws IOException { VBox vbox = new VBox(); File[] drives = File.listRoots(); ArrayList<File> fileListing; /*for (File dir : drives) { System.out.println(dir.toString()); fileListing = restrictingList(dir); }*//*from w ww . j a v a2 s .co m*/ fileListing = restrictingList(new File("D:\\")); ArrayList<TreeItem> treeItems = new ArrayList<>(); for (File dir : drives) { //System.out.println(dir.toString()); treeItems.add(createNode(dir)); } TreeView<File> tree = proxyCreateNode(treeItems); vbox.getChildren().add(tree); tree.getSelectionModel().selectedItemProperty() .addListener((ObservableValue<? extends TreeItem<File>> observable, TreeItem<File> oldValue, TreeItem<File> newValue) -> { System.out.println("Selected Text: " + newValue.getValue()); TreeItem<File> selectedItem = newValue; System.out.println("Selected Text: " + selectedItem.getValue()); try { //FileTreeView fileTreeView = new FileTreeView(); System.out.println("File Tree View Event"); fileTreeView.GetFilesFromFolder((newValue.getValue().toString())); //fileTreeView.SetFileTreeView(); } catch (IOException ex) { System.err.println("Unable to pass fileTreeView Value \nPassed Value: " + selectedItem.getValue().toString() + "\r\nError Message:\r\n" + ex.toString()); Logger.getLogger(FolderTreeView.class.getName()).log(Level.SEVERE, null, ex); } } /* @Override public void changed( ObservableValue<? extends TreeItem<File>> observable, TreeItem<String> old_val, TreeItem<File> new_val) { }*/ ); return vbox; }