List of usage examples for javafx.scene.layout Pane getChildren
@Override
public ObservableList<Node> getChildren()
From source file:org.pdfsam.ui.dashboard.about.AboutDashboardPane.java
private void addHyperlink(AwesomeIcon icon, String url, String text, Pane pane) { UrlButton button = new UrlButton(text, url); button.getStyleClass().setAll("pdfsam-hyperlink"); if (icon != null) { AwesomeDude.setIcon(button, icon); }/* ww w . j a va 2 s.c om*/ pane.getChildren().add(button); }
From source file:MediaControl.java
public MediaControl(final MediaPlayer mp) { this.mp = mp; setStyle("-fx-background-color: #bfc2c7;"); mediaView = new MediaView(mp); Pane mvPane = new Pane() { };// w w w .j a va 2s .c o m mvPane.getChildren().add(mediaView); mvPane.setStyle("-fx-background-color: black;"); setCenter(mvPane); mediaBar = new HBox(); mediaBar.setAlignment(Pos.CENTER); mediaBar.setPadding(new Insets(5, 10, 5, 10)); BorderPane.setAlignment(mediaBar, Pos.CENTER); final Button playButton = new Button(">"); playButton.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { Status status = mp.getStatus(); if (status == Status.UNKNOWN || status == Status.HALTED) { // don't do anything in these states return; } if (status == Status.PAUSED || status == Status.READY || status == Status.STOPPED) { // rewind the movie if we're sitting at the end if (atEndOfMedia) { mp.seek(mp.getStartTime()); atEndOfMedia = false; } mp.play(); } else { mp.pause(); } } }); mp.currentTimeProperty().addListener(new InvalidationListener() { public void invalidated(Observable ov) { updateValues(); } }); mp.setOnPlaying(new Runnable() { public void run() { if (stopRequested) { mp.pause(); stopRequested = false; } else { playButton.setText("||"); } } }); mp.setOnPaused(new Runnable() { public void run() { System.out.println("onPaused"); playButton.setText(">"); } }); mp.setOnReady(new Runnable() { public void run() { duration = mp.getMedia().getDuration(); updateValues(); } }); mp.setCycleCount(repeat ? MediaPlayer.INDEFINITE : 1); mp.setOnEndOfMedia(new Runnable() { public void run() { if (!repeat) { playButton.setText(">"); stopRequested = true; atEndOfMedia = true; } } }); mediaBar.getChildren().add(playButton); // Add spacer Label spacer = new Label(" "); mediaBar.getChildren().add(spacer); // Add Time label Label timeLabel = new Label("Time: "); mediaBar.getChildren().add(timeLabel); // Add time slider timeSlider = new Slider(); HBox.setHgrow(timeSlider, Priority.ALWAYS); timeSlider.setMinWidth(50); timeSlider.setMaxWidth(Double.MAX_VALUE); timeSlider.valueProperty().addListener(new InvalidationListener() { public void invalidated(Observable ov) { if (timeSlider.isValueChanging()) { // multiply duration by percentage calculated by slider position mp.seek(duration.multiply(timeSlider.getValue() / 100.0)); } } }); mediaBar.getChildren().add(timeSlider); // Add Play label playTime = new Label(); playTime.setPrefWidth(130); playTime.setMinWidth(50); mediaBar.getChildren().add(playTime); // Add the volume label Label volumeLabel = new Label("Vol: "); mediaBar.getChildren().add(volumeLabel); // Add Volume slider volumeSlider = new Slider(); volumeSlider.setPrefWidth(70); volumeSlider.setMaxWidth(Region.USE_PREF_SIZE); volumeSlider.setMinWidth(30); volumeSlider.valueProperty().addListener(new InvalidationListener() { public void invalidated(Observable ov) { if (volumeSlider.isValueChanging()) { mp.setVolume(volumeSlider.getValue() / 100.0); } } }); mediaBar.getChildren().add(volumeSlider); setBottom(mediaBar); }
From source file:com.github.xwgou.namesurfer.fxui.JFXNameSurfer.java
@Override public void start(final Stage stage) { try {//ww w .j a v a 2 s . c om final ScalableContentPane scp = new ScalableContentPane(); scp.setStyle("-fx-background-color: green;"); Pane root = scp.getContentPane(); final JFXNameSurferPanel rootNode = new JFXNameSurferPanel(translator); rootNode.controller.exportButton.setDisable(disable_buttons); rootNode.controller.saveButton.setDisable(disable_buttons); root.getChildren().add(rootNode); final Scene scene = new Scene(scp, 1024, 576); scene.getStylesheets() .add(getClass().getResource("/com/github/xwgou/namesurfer/css/color.css").toExternalForm()); scp.layoutBoundsProperty().addListener((observable, oldValue, newValue) -> { double aspect_ratio = scp.getWidth() / scp.getHeight(); logger.debug(scp.getLayoutBounds().toString()); logger.debug("" + aspect_ratio); double w = 1024.0; double h = 576.0; if (aspect_ratio > 1024 / 576) w = 576 * aspect_ratio; else h = 1024 / aspect_ratio; rootNode.setPrefWidth(w); rootNode.setPrefHeight(h); }); stage.setTitle("NameSurfer"); stage.setScene(scene); stage.setFullScreen(fullscreen); stage.show(); } catch (Exception ex) { logger.error("Exception during application startup", ex); throw ex; } }
From source file:io.bitsquare.app.BitsquareApp.java
private void showFPSWindow() { Label label = new Label(); EventStreams.animationTicks().latestN(100).map(ticks -> { int n = ticks.size() - 1; return n * 1_000_000_000.0 / (ticks.get(n) - ticks.get(0)); }).map(d -> String.format("FPS: %.3f", d)).feedTo(label.textProperty()); Pane root = new StackPane(); root.getChildren().add(label); Stage stage = new Stage(); stage.setScene(new Scene(root)); stage.setTitle("FPS"); stage.initModality(Modality.NONE);/*w ww . java 2s . com*/ stage.initStyle(StageStyle.UTILITY); stage.initOwner(scene.getWindow()); stage.setX(primaryStage.getX() + primaryStage.getWidth() + 10); stage.setY(primaryStage.getY()); stage.setWidth(200); stage.setHeight(100); stage.show(); }
From source file:com.panemu.tiwulfx.form.Form.java
private void scanInputControls(Node node) { Pane parent = null; if (node instanceof Pane) { parent = (Pane) node;//from ww w .java2 s . c o m } else if (node instanceof TitledPane) { scanInputControls(((TitledPane) node).getContent()); return; } else if (node instanceof ScrollPane) { scanInputControls(((ScrollPane) node).getContent()); return; } if (parent == null) { return; } for (final Node component : parent.getChildren()) { if (!(component instanceof BaseControl)) { scanInputControls(component); } else if (component instanceof BaseControl) { BaseControl baseControl = (BaseControl) component; lstInputControl.add(baseControl); mapEditable.put(baseControl, baseControl.isEditable()); baseControl.editableProperty().addListener(new EditableController(baseControl)); if (component instanceof LookupControl) { ((BaseControl) component).valueProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue ov, Object t, Object t1) { updateNestedObject(((BaseControl) component).getPropertyName(), t1); } }); } } } }
From source file:com.github.drbookings.ui.controller.BookingDetailsController.java
private static void addRow0(final Pane content, final BookingBean be) { final HBox box = new HBox(); final HBox boxName = new HBox(); final HBox boxDates = new HBox(); final HBox boxNights = new HBox(); box.setAlignment(Pos.CENTER);/* www.j a v a 2s . c o m*/ boxName.getStyleClass().add("first-line"); boxDates.getStyleClass().add("first-line"); boxNights.getStyleClass().add("first-line"); boxName.setPadding(boxPadding); boxDates.setPadding(boxPadding); boxNights.setPadding(boxPadding); boxName.setAlignment(Pos.CENTER); boxDates.setAlignment(Pos.CENTER); boxNights.setAlignment(Pos.CENTER); HBox.setHgrow(boxName, Priority.ALWAYS); HBox.setHgrow(boxDates, Priority.ALWAYS); HBox.setHgrow(boxNights, Priority.ALWAYS); addName(boxName, be); // box.getChildren().add(new Separator(Orientation.VERTICAL)); addDates(boxDates, be); // box.getChildren().add(new Separator(Orientation.VERTICAL)); addNights(boxNights, be); box.getChildren().addAll(boxName, boxDates, boxNights); box.getStyleClass().add(Styles.getBackgroundStyleSource(be.getBookingOrigin().getName())); content.getChildren().add(box); }
From source file:com.thomaskuenneth.tkmactuning.TKMacTuning.java
private void addPlugin(TabPane tabPane, String className, String pluginName) { try {/* w ww .j ava 2 s .c o m*/ Class clazz = Class.forName(className); Constructor cons = clazz.getConstructor(TKMacTuning.class, String.class); AbstractPlugin plugin = (AbstractPlugin) cons.newInstance(this, pluginName); String primaryUICategory = plugin.getPrimaryUICategory(); Tab tab = (Tab) tabPane.getProperties().get(primaryUICategory); if (tab == null) { tab = new Tab(primaryUICategory); tabPane.getProperties().put(primaryUICategory, tab); tabPane.getTabs().add(tab); VBox content = new VBox(); content.setPadding(LayoutConstants.PADDING_1); content.setSpacing(LayoutConstants.VERTICAL_CONTROL_GAP); tab.setContent(content); } VBox content = (VBox) tab.getContent(); Node node = plugin.getNode(); if (node != null) { String secondaryUICategory = plugin.getSecondaryUICategory(); if (AbstractPlugin.ROOT.equals(secondaryUICategory)) { content.getChildren().add(node); } else { Pane group = (Pane) tabPane.getProperties().get(GROUP + secondaryUICategory); if (group == null) { group = new VBox(LayoutConstants.VERTICAL_CONTROL_GAP); tabPane.getProperties().put(GROUP + secondaryUICategory, group); HBox headline = new HBox(); headline.setStyle( "-fx-border-insets: 0 0 1 0; -fx-border-color: transparent transparent -fx-text-box-border transparent; -fx-border-width: 1;"); headline.getChildren().add(new Label(secondaryUICategory)); group.getChildren().add(headline); content.getChildren().add(group); } group.getChildren().add(node); } } else { LOGGER.log(Level.SEVERE, "could not create control for plugin {0}({1})", new Object[] { className, pluginName }); } } catch (InstantiationException | ClassNotFoundException | NoSuchMethodException | SecurityException | InvocationTargetException | IllegalAccessException ex) { LOGGER.log(Level.SEVERE, "addPlugin()", ex); } }
From source file:com.github.drbookings.ui.controller.BookingDetailsController.java
private void addCheckInNote(final Pane content, final BookingBean be) { final VBox b = new VBox(); b.getChildren().add(new Text("Check-in Note")); final TextArea ta0 = new TextArea(be.getCheckInNote()); ta0.setWrapText(true);//from ww w . j a v a2 s . co m ta0.setPrefHeight(80); b.getChildren().add(ta0); booking2CheckInNote.put(be, ta0); content.getChildren().add(b); }
From source file:com.github.drbookings.ui.controller.BookingDetailsController.java
private void addCheckOutNote(final Pane content, final BookingBean be) { final VBox b = new VBox(); b.getChildren().add(new Text("Check-out Note")); final TextArea ta0 = new TextArea(be.getCheckOutNote()); ta0.setWrapText(true);/*from ww w. j a va 2s .co m*/ ta0.setPrefHeight(80); b.getChildren().add(ta0); booking2CheckOutNote.put(be, ta0); content.getChildren().add(b); }
From source file:org.mskcc.shenkers.view.IntervalViewNGTest.java
public Node get(RangeSet<Integer> intervals, int start, int end) { RangeSet<Integer> view = intervals.subRangeSet(Range.closed(start, end)); double l = end - start + 1.; Pane p = new Pane(); for (Range<Integer> interval : view.asRanges()) { Rectangle r = new Rectangle(); r.widthProperty().bind(/*www. java 2s.c om*/ p.widthProperty().multiply(interval.upperEndpoint() - interval.lowerEndpoint() + 1).divide(l)); r.heightProperty().bind(p.heightProperty()); r.xProperty().bind(p.widthProperty().multiply(interval.lowerEndpoint()).divide(l)); // System.out.println(r); p.getChildren().add(r); } return p; }