List of usage examples for javafx.geometry Pos TOP_CENTER
Pos TOP_CENTER
To view the source code for javafx.geometry Pos TOP_CENTER.
Click Source Link
From source file:Main.java
@Override public void start(Stage primaryStage) { final Label markerText = new Label(); StackPane.setAlignment(markerText, Pos.TOP_CENTER); String workingDir = System.getProperty("user.dir"); final File f = new File(workingDir, "../media/omgrobots.flv"); final Media m = new Media(f.toURI().toString()); final ObservableMap<String, Duration> markers = m.getMarkers(); markers.put("Robot Finds Wall", Duration.millis(3100)); markers.put("Then Finds the Green Line", Duration.millis(5600)); markers.put("Robot Grabs Sled", Duration.millis(8000)); markers.put("And Heads for Home", Duration.millis(11500)); final MediaPlayer mp = new MediaPlayer(m); mp.setOnMarker(new EventHandler<MediaMarkerEvent>() { @Override//from ww w. j a v a 2s .c om public void handle(final MediaMarkerEvent event) { Platform.runLater(new Runnable() { @Override public void run() { markerText.setText(event.getMarker().getKey()); } }); } }); final MediaView mv = new MediaView(mp); final StackPane root = new StackPane(); root.getChildren().addAll(mv, markerText); root.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { mp.seek(Duration.ZERO); markerText.setText(""); } }); final Scene scene = new Scene(root, 960, 540); final URL stylesheet = getClass().getResource("media.css"); scene.getStylesheets().add(stylesheet.toString()); primaryStage.setScene(scene); primaryStage.setTitle("Video Player 2"); primaryStage.show(); mp.play(); }
From source file:org.pdfsam.merge.MergeModule.java
@Override protected Pane getInnerPanel() { VBox pane = new VBox(); pane.setAlignment(Pos.TOP_CENTER); VBox.setVgrow(selectionPane, Priority.ALWAYS); pane.getChildren().addAll(selectionPane, titledPane(DefaultI18nContext.getInstance().i18n("Merge settings"), mergeOptions), titledPane(DefaultI18nContext.getInstance().i18n("Destination file"), destinationPane)); return pane;//from w ww. ja v a 2 s .co m }
From source file:org.pdfsam.rotate.RotateModule.java
@Override protected Pane getInnerPanel() { VBox pane = new VBox(); pane.setAlignment(Pos.TOP_CENTER); VBox.setVgrow(selectionPane, Priority.ALWAYS); TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"), prefix);//w ww . j av a 2 s . co m prefix.addMenuItemFor(Prefix.FILENUMBER); TitledPane options = Views.titledPane(DefaultI18nContext.getInstance().i18n("Rotate settings"), rotateOptions); pane.getChildren().addAll(selectionPane, options, Views.titledPane(DefaultI18nContext.getInstance().i18n("Destination directory"), destinationPane), prefixTitled); return pane; }
From source file:Main.java
private void createClipList(GridPane grid) { final VBox vbox = new VBox(30); vbox.setAlignment(Pos.TOP_CENTER); 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);//from w ww.ja va 2 s . c o m 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); }
From source file:org.pdfsam.alternatemix.AlternateMixModule.java
@Override protected Pane getInnerPanel() { VBox pane = new VBox(); pane.setAlignment(Pos.TOP_CENTER); pane.getChildren().addAll(firstDocument, secondDocument, Views.titledPane(DefaultI18nContext.getInstance().i18n("Mix settings"), optionsPane), Views.titledPane(DefaultI18nContext.getInstance().i18n("Destination file"), destinationPane)); return pane;//from w ww .j a v a 2 s .co m }
From source file:org.pdfsam.split.SplitModule.java
@Override protected Pane getInnerPanel() { VBox pane = new VBox(); pane.setAlignment(Pos.TOP_CENTER); TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"), prefix);/*from w ww .j a v a 2 s .co m*/ prefix.addMenuItemFor(Prefix.CURRENTPAGE); prefix.addMenuItemFor(Prefix.FILENUMBER); pane.getChildren().addAll(selectionPane, Views.titledPane(DefaultI18nContext.getInstance().i18n("Split settings"), splitOptions), Views.titledPane(DefaultI18nContext.getInstance().i18n("Destination directory"), destinationPane), prefixTitled); return pane; }
From source file:org.pdfsam.splitbybookmarks.SplitByBookmarksModule.java
@Override protected Pane getInnerPanel() { VBox pane = new VBox(); pane.setAlignment(Pos.TOP_CENTER); TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"), prefix);/* w ww .j a v a2 s . co m*/ prefix.addMenuItemFor(Prefix.CURRENTPAGE); prefix.addMenuItemFor(Prefix.FILENUMBER); prefix.addMenuItemFor(Prefix.BOOKMARK); prefix.addMenuItemFor(Prefix.BOOKMARK_STRICT); pane.getChildren().addAll(selectionPane, Views.titledPane(DefaultI18nContext.getInstance().i18n("Split settings"), splitOptions), Views.titledPane(DefaultI18nContext.getInstance().i18n("Destination directory"), destinationPane), prefixTitled); return pane; }
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//from w w w . j av a 2 s . co m 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:guipart.AddMessageUploadFile.java
private void setScene(Stage window) { fileNames = new ArrayList<File>(); fileList = new ListView<String>(); files = FXCollections.observableArrayList(); fileList.setItems(files);/*from www.j ava2 s . c o m*/ fileList.setTranslateY(-50); fileList.setMaxWidth(300); fileList.setMinHeight(150); Label addMessagesLabel = new Label("Add messages"); Label loadedMessagesLabel = new Label("Loaded messages:"); Label imageLabel2 = new Label(); Image image2 = new Image(getClass().getResourceAsStream("/resources/gui/labelme_logo.png")); imageLabel2.setGraphic(new ImageView(image2)); imageLabel2.setPrefSize(200, 200); HBox imageBox2 = new HBox(); imageBox2.setAlignment(Pos.CENTER); imageBox2.setPadding(new Insets(20, 20, 20, 20)); imageBox2.getChildren().add(imageLabel2); acceptButton = new Button("Accept All"); browseButton = new Button("Browse"); finishButton = new Button("Finish"); previousButton = new Button("Previous"); cancelButton = new Button("X"); backButton = new Button("Back"); pathField.setMinWidth(200); textCategory = new Label(); addMessagesLabel.setFont(Font.font("Arial", FontWeight.BOLD, 28)); HBox hBox = new HBox(); hBox.setSpacing(20); hBox.getChildren().addAll(browseButton, pathField, acceptButton); hBox.setAlignment(Pos.CENTER); VBox layout = new VBox(); layout.setSpacing(30); VBox filesPlaceholder = new VBox(); filesPlaceholder.setSpacing(10); backButton.setTranslateY(-50); browseButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { //TODO: add more extensionFilters File currDir = new File("."); fileChooser.setInitialDirectory(currDir); fileChooser.getExtensionFilters().addAll((new FileChooser.ExtensionFilter("Text Files", "*.txt"))); File file = fileChooser.showOpenDialog(window); if (file != null) { pathField.setText(file.getName()); fileNames.add(file); files.add(file.getName()); } } }); fileList.setOnMouseClicked(e -> { //System.out.println(fileList.getSelectionModel().getSelectedItem()); files.remove(fileList.getSelectionModel().getSelectedItem()); for (File file : fileNames) { if (file.getName().equals(fileList.getSelectionModel().getSelectedItem())) { fileNames.remove(file); break; } } }); acceptButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { if (!fileNames.isEmpty()) { Categorize categorize = new Categorize(); categorize.trainModel(); int size = files.size(); for (int i = 0; i < size; i++) { String fileName = files.get(i); for (File file : fileNames) { if (file.getName().equals(fileName)) { try { files.add(fileName + " " + categorize.getCategory(FileUtils.readFileToString(file, "UTF-8"))); } catch (IOException ex) { Logger.getLogger(AddMessageUploadFile.class.getName()).log(Level.SEVERE, null, ex); } } } } int i = 0; while (i < size) { files.remove(0); i++; } /* try { textCategory.setText("The text category is: " + categorize.getCategory(FileUtils.readFileToString(fileNames.get(fileNames.size() - 1), "UTF-8"))); } catch (IOException ex) { Logger.getLogger(AddMessageUploadFile.class.getName()).log(Level.SEVERE, null, ex); }*/ } /* if (pathField.getText() != null) { int index = pathField.getText().lastIndexOf("\\"); Label messageLabel = new Label(pathField.getText().substring(index + 1)); messageLabel.setMinWidth(200); messageLabel.setMinHeight(25); messageLabel.setStyle("-fx-fill: orange;\n" + "-fx-border-color: blue;\n" + "-fx-border-width: 3;\n"); if (filesPlaceholder.getChildren().size() != 0) { layout.getChildren().remove(layout.getChildren().size() - 1); } filesPlaceholder.getChildren().addAll(messageLabel); filesPlaceholder.setAlignment(Pos.CENTER); filesPlaceholder.setPadding(new Insets(0, 0, 0, 50)); layout.getChildren().add(filesPlaceholder); }*/ } }); backButton.setOnAction(e -> { window.setScene(mainPage.mainPageScene); }); layout.getChildren().addAll(imageLabel2, addMessagesLabel, hBox, textCategory, fileList, backButton); layout.setStyle("-fx-background-color: white"); layout.setAlignment(Pos.TOP_CENTER); layout.setStyle("-fx-background-color: #B8EDFF;"); scene = new Scene(layout, 900, 600); }
From source file:dpfmanager.shell.interfaces.gui.component.dessign.DessignView.java
private void showLoadingConfig() { ProgressIndicator pi = new ProgressIndicator(); pi.setPrefWidth(75);/*from w w w.j av a2s . com*/ pi.setPrefHeight(75); pi.setProgress(-1); vBoxConfig = new VBox(); vBoxConfig.setAlignment(Pos.TOP_CENTER); vBoxConfig.setPrefWidth(configScroll.getWidth() - 5); vBoxConfig.getChildren().add(pi); VBox.setMargin(pi, new Insets(10, 0, 0, 0)); configScroll.setContent(vBoxConfig); }