List of usage examples for javafx.scene.layout VBox getChildren
@Override
public ObservableList<Node> getChildren()
From source file:Main.java
@Override public void start(Stage stage) { stage.setTitle("HTML"); stage.setWidth(500);/* w w w.j a v a2s . c o m*/ stage.setHeight(500); Scene scene = new Scene(new Group()); VBox root = new VBox(); InnerShadow is = new InnerShadow(); is.setOffsetX(4.0); is.setOffsetY(4.0); Text t = new Text(); t.setEffect(is); t.setX(20); t.setY(100); t.setText("java2s.com"); t.setFill(Color.YELLOW); t.setFont(Font.font(null, FontWeight.BOLD, 80)); root.getChildren().addAll(t); scene.setRoot(root); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { VBox box = new VBox(); final Scene scene = new Scene(box, 300, 250); scene.setFill(null);//w w w . j a v a 2s. co m Stop[] stops = new Stop[] { new Stop(0, Color.BLACK), new Stop(1, Color.RED) }; LinearGradient lg1 = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, stops); Rectangle r1 = new Rectangle(0, 0, 100, 100); r1.setFill(lg1); box.getChildren().add(r1); stage.setScene(scene); stage.show(); }
From source file:UI.MainPageController.java
/** * Popup dialog box that display the string passed in * @param warning /* w w w. j ava 2 s. c o m*/ */ private void showWarning(String warning) { Stage popup = new Stage(); VBox headsUp = new VBox(); Text prompt = new Text(warning); prompt.setStyle("-fx-font-size: 11pt;"); headsUp.getChildren().add(prompt); headsUp.setAlignment(Pos.CENTER); popup.setScene(new Scene(headsUp, 300, 200)); popup.setTitle("Warning"); popup.show(); }
From source file:gov.va.isaac.gui.preferences.PreferencesViewController.java
public void aboutToShow() { // Using allValid_ to prevent rerunning content of aboutToShow() if (allValid_ == null) { // These listeners are for debug and testing only. They may be removed at any time. UserProfileBindings userProfileBindings = AppContext.getService(UserProfileBindings.class); for (Property<?> property : userProfileBindings.getAll()) { property.addListener(new ChangeListener<Object>() { @Override/* www .j av a 2s . c om*/ public void changed(ObservableValue<? extends Object> observable, Object oldValue, Object newValue) { logger.debug("{} property changed from {} to {}", property.getName(), oldValue, newValue); } }); } // load fields before initializing allValid_ // in case plugin.validationFailureMessageProperty() initialized by getNode() tabPane_.getTabs().clear(); List<PreferencesPluginViewI> sortableList = new ArrayList<>(); Comparator<PreferencesPluginViewI> comparator = new Comparator<PreferencesPluginViewI>() { @Override public int compare(PreferencesPluginViewI o1, PreferencesPluginViewI o2) { if (o1.getTabOrder() == o2.getTabOrder()) { return o1.getName().compareTo(o2.getName()); } else { return o1.getTabOrder() - o2.getTabOrder(); } } }; for (PreferencesPluginViewI plugin : plugins_) { sortableList.add(plugin); } Collections.sort(sortableList, comparator); for (PreferencesPluginViewI plugin : sortableList) { logger.debug("Adding PreferencesPluginView tab \"{}\"", plugin.getName()); Label tabLabel = new Label(plugin.getName()); tabLabel.setMaxHeight(Double.MAX_VALUE); tabLabel.setMaxWidth(Double.MAX_VALUE); Tab pluginTab = new Tab(); pluginTab.setGraphic(tabLabel); Region content = plugin.getContent(); content.setMaxWidth(Double.MAX_VALUE); content.setMaxHeight(Double.MAX_VALUE); content.setPadding(new Insets(5.0)); Label errorMessageLabel = new Label(); errorMessageLabel.textProperty().bind(plugin.validationFailureMessageProperty()); errorMessageLabel.setAlignment(Pos.BOTTOM_CENTER); TextErrorColorHelper.setTextErrorColor(errorMessageLabel); VBox vBox = new VBox(); vBox.getChildren().addAll(errorMessageLabel, content); vBox.setMaxWidth(Double.MAX_VALUE); vBox.setAlignment(Pos.TOP_CENTER); plugin.validationFailureMessageProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if (newValue != null && !StringUtils.isEmpty(newValue)) { TextErrorColorHelper.setTextErrorColor(tabLabel); } else { TextErrorColorHelper.clearTextErrorColor(tabLabel); } } }); //Initialize, if stored value is wrong if (StringUtils.isNotEmpty(plugin.validationFailureMessageProperty().getValue())) { TextErrorColorHelper.setTextErrorColor(tabLabel); } pluginTab.setContent(vBox); tabPane_.getTabs().add(pluginTab); } allValid_ = new ValidBooleanBinding() { { ArrayList<ReadOnlyStringProperty> pluginValidationFailureMessages = new ArrayList<>(); for (PreferencesPluginViewI plugin : plugins_) { pluginValidationFailureMessages.add(plugin.validationFailureMessageProperty()); } bind(pluginValidationFailureMessages .toArray(new ReadOnlyStringProperty[pluginValidationFailureMessages.size()])); setComputeOnInvalidate(true); } @Override protected boolean computeValue() { for (PreferencesPluginViewI plugin : plugins_) { if (plugin.validationFailureMessageProperty().get() != null && plugin.validationFailureMessageProperty().get().length() > 0) { this.setInvalidReason(plugin.validationFailureMessageProperty().get()); logger.debug("Setting PreferencesView allValid_ to false because \"{}\"", this.getReasonWhyInvalid().get()); return false; } } logger.debug("Setting PreferencesView allValid_ to true"); this.clearInvalidReason(); return true; } }; okButton_.disableProperty().bind(allValid_.not()); // set focus on default // Platform.runLater(...); } // Reload persisted values every time view opened for (PreferencesPluginViewI plugin : plugins_) { plugin.getContent(); } }
From source file:org.pdfsam.ui.dashboard.about.AboutDashboardPane.java
@Inject public AboutDashboardPane(Pdfsam pdfsam) { getStyleClass().add("dashboard-container"); VBox left = new VBox(5); addSectionTitle(pdfsam.name(), left); Label copyright = new Label("Copyright 2014 by Andrea Vacondio"); AwesomeDude.setIcon(copyright, AwesomeIcon.COPYRIGHT); left.getChildren().addAll(new Label(String.format("ver. %s", pdfsam.version())), copyright); addHyperlink(null, "http://www.gnu.org/licenses/agpl-3.0.html", "GNU Affero General Public License v3", left);/*www.j a va 2 s. c om*/ addHyperlink(AwesomeIcon.HOME, "http://www.pdfsam.org", "www.pdfsam.org", left); addHyperlink(AwesomeIcon.RSS_SQUARE, "http://www.pdfsam.org/feed/", DefaultI18nContext.getInstance().i18n("Subscribe to the official news feed"), left); addSectionTitle(DefaultI18nContext.getInstance().i18n("Environment"), left); Label runtime = new Label(String.format("%s %s", System.getProperty("java.runtime.name"), System.getProperty("java.runtime.version"))); Label fxRuntime = new Label( String.format("JavaFX %s", com.sun.javafx.runtime.VersionInfo.getRuntimeVersion())); Label memory = new Label(DefaultI18nContext.getInstance().i18n("Max memory {0}", FileUtils.byteCountToDisplaySize(Runtime.getRuntime().maxMemory()))); Button copyButton = new Button(DefaultI18nContext.getInstance().i18n("Copy to clipboard")); AwesomeDude.setIcon(copyButton, AwesomeIcon.COPY); copyButton.getStyleClass().addAll(Style.BUTTON.css()); copyButton.setId("copyEnvDetails"); copyButton.setOnAction(a -> { ClipboardContent content = new ClipboardContent(); writeContent(Arrays.asList(pdfsam.name(), pdfsam.version(), runtime.getText(), fxRuntime.getText(), memory.getText())).to(content); Clipboard.getSystemClipboard().setContent(content); }); left.getChildren().addAll(runtime, fxRuntime, memory, copyButton); addSectionTitle(DefaultI18nContext.getInstance().i18n("Thanks to"), left); addHyperlink(null, "http://www.pdfsam.org/thanks_to", DefaultI18nContext.getInstance().i18n("The open source projects making PDFsam possible"), left); VBox right = new VBox(5); addSectionTitle(DefaultI18nContext.getInstance().i18n("Support"), right); addHyperlink(AwesomeIcon.BUG, "http://www.pdfsam.org/issue_tracker", DefaultI18nContext.getInstance().i18n("Bug and feature requests"), right); addHyperlink(AwesomeIcon.QUESTION_CIRCLE, "http://www.pdfsam.org/wiki", "HowTo wiki", right); addHyperlink(AwesomeIcon.YOUTUBE_PLAY, "http://www.pdfsam.org/quickstart_video", DefaultI18nContext.getInstance().i18n("Play the \"get started\" video"), right); addSectionTitle(DefaultI18nContext.getInstance().i18n("Contribute"), right); addHyperlink(AwesomeIcon.GITHUB, "http://www.pdfsam.org/scm", DefaultI18nContext.getInstance().i18n("Fork PDFsam on GitHub"), right); addHyperlink(AwesomeIcon.FLAG_ALT, "http://www.pdfsam.org/translate", DefaultI18nContext.getInstance().i18n("Translate"), right); addHyperlink(AwesomeIcon.DOLLAR, "http://www.pdfsam.org/donate", DefaultI18nContext.getInstance().i18n("Donate"), right); addSectionTitle(DefaultI18nContext.getInstance().i18n("Social"), right); addHyperlink(AwesomeIcon.TWITTER_SQUARE, "http://www.pdfsam.org/twitter", DefaultI18nContext.getInstance().i18n("Follow us on Twitter"), right); addHyperlink(AwesomeIcon.GOOGLE_PLUS_SQUARE, "http://www.pdfsam.org/gplus", DefaultI18nContext.getInstance().i18n("Follow us on Google Plus"), right); addHyperlink(AwesomeIcon.FACEBOOK_SQUARE, "http://www.pdfsam.org/facebook", DefaultI18nContext.getInstance().i18n("Like us on Facebook"), right); getChildren().addAll(left, right); }
From source file:Main.java
@Override public void start(Stage stage) { stage.setTitle("HTML"); stage.setWidth(500);//from ww w .j ava 2 s.com stage.setHeight(500); Scene scene = new Scene(new Group()); VBox root = new VBox(); final WebView browser = new WebView(); final WebEngine webEngine = browser.getEngine(); Hyperlink hpl = new Hyperlink("java2s.com"); hpl.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { webEngine.load("http://java2s.com"); } }); root.getChildren().addAll(hpl, browser); scene.setRoot(root); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Button Sample"); stage.setWidth(300);/*from w w w . j a v a 2 s. c o m*/ stage.setHeight(190); VBox vbox = new VBox(); vbox.setLayoutX(20); vbox.setLayoutY(20); TreeItem<String> root = new TreeItem<String>("Root Node"); root.setExpanded(true); root.getChildren().addAll(new TreeItem<String>("Item 1"), new TreeItem<String>("Item 2"), new TreeItem<String>("Item 3")); TreeView<String> treeView = new TreeView<String>(root); vbox.getChildren().add(treeView); vbox.setSpacing(10); ((Group) scene.getRoot()).getChildren().add(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 260, 80); stage.setScene(scene);//from w w w.j a v a 2 s . com stage.setTitle(""); VBox vb = new VBox(); Pane canvas = new Pane(); canvas.setStyle("-fx-background-color: black;"); canvas.setPrefSize(200, 200); Circle circle = new Circle(50, Color.BLUE); circle.relocate(20, 20); Rectangle rectangle = new Rectangle(100, 100, Color.RED); rectangle.relocate(70, 70); canvas.getChildren().addAll(circle, rectangle); vb.getChildren().add(canvas); scene.setRoot(vb); stage.show(); }
From source file:org.jacp.demo.perspectives.ContactPerspective.java
@PostConstruct /**//from w w w . j a v a 2 s. co m * create buttons in tool bars; menu entries */ public void PostConstructPerspective(final FXComponentLayout layout, final ResourceBundle resourceBundle) { LOGGER.debug("PostConstructPerspective ressource:" + resourceBundle); // create button in toolbar; button should switch top and bottom id's final JACPToolBar north = layout.getRegisteredToolBar(NORTH); final JACPToolBar south = layout.getRegisteredToolBar(SOUTH); final JACPToolBar west = layout.getRegisteredToolBar(WEST); final JACPToolBar east = layout.getRegisteredToolBar(EAST); final Button custom = new Button("switch"); custom.setTooltip(new Tooltip("Switch Components")); custom.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent e) { context.send(SWITCH_MESSAGE); } }); north.addOnEnd(context.getId(), custom); // TEST OPTIONBUTTON ON NORTH north.addOnEnd(context.getId(), JACPOptionButtonCreator.createDefaultOptionButton("another Button", layout, BOTTOM, 10)); north.addToCenter(context.getId(), JACPOptionButtonCreator.createDefaultOptionButton("another Button", layout, BOTTOM, 10)); north.add(context.getId(), JACPOptionButtonCreator.createDefaultOptionButton("another Button", layout, BOTTOM, 10)); west.add(context.getId(), JACPOptionButtonCreator.createDefaultOptionButton("another Button", layout, RIGHT)); west.addToCenter(context.getId(), JACPOptionButtonCreator.createDefaultOptionButton("another Button", layout, RIGHT)); west.addOnEnd(context.getId(), JACPOptionButtonCreator.createDefaultOptionButton("another Button", layout, RIGHT)); east.addOnEnd(context.getId(), JACPOptionButtonCreator.createDefaultOptionButton("right Button", layout, LEFT)); east.add(context.getId(), JACPOptionButtonCreator.createDefaultOptionButton("right Button", layout, LEFT)); east.addToCenter(context.getId(), JACPOptionButtonCreator.createDefaultOptionButton("right Button", layout, LEFT)); south.add(context.getId(), JACPOptionButtonCreator.createDefaultOptionButton("bottom Button", layout, TOP)); south.addToCenter(context.getId(), JACPOptionButtonCreator.createDefaultOptionButton("bottom Button", layout, TOP)); south.addOnEnd(context.getId(), JACPOptionButtonCreator.createDefaultOptionButton("bottom Button", layout, TOP)); JACPHoverMenu menu = new JACPHoverMenu("Hovermenu", layout); VBox p = new VBox(); p.setPadding(new Insets(10)); Button b = new Button("HELLO"); CheckBox check = new CheckBox("checkbox"); p.getChildren().addAll(b, check); ColorPicker picker = new ColorPicker(); menu.getContentPane().getChildren().add(p); north.addToCenter(context.getId(), menu); north.addToCenter(context.getId(), picker); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Sample"); stage.setWidth(300);//w ww .jav a 2 s . c o m stage.setHeight(190); VBox vbox = new VBox(); vbox.setLayoutX(20); vbox.setLayoutY(20); Rectangle rect = new Rectangle(100, 40, 100, 100); rect.setArcHeight(50); rect.setArcWidth(50); rect.setFill(Color.VIOLET); TranslateTransition tt = new TranslateTransition(Duration.millis(2000), rect); tt.setByX(200f); tt.setAutoReverse(true); tt.play(); vbox.getChildren().add(rect); vbox.setSpacing(10); ((Group) scene.getRoot()).getChildren().add(vbox); stage.setScene(scene); stage.show(); }