javafx.scene.layout.Pane Java Examples
The following examples show how to use
javafx.scene.layout.Pane.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: thundernetwork Author: matsjj File: Main.java License: GNU Affero General Public License v3.0 | 6 votes |
/** * Loads the FXML file with the given name, blurs out the main UI and puts this one on top. */ public <T> OverlayUI<T> overlayUI (String name) { try { checkGuiThread(); // Load the UI from disk. URL location = GuiUtils.getResource(name); FXMLLoader loader = new FXMLLoader(location); Pane ui = loader.load(); T controller = loader.getController(); OverlayUI<T> pair = new OverlayUI<T>(ui, controller); // Auto-magically set the overlayUI member, if it's there. try { if (controller != null) { controller.getClass().getField("overlayUI").set(controller, pair); } } catch (IllegalAccessException | NoSuchFieldException ignored) { ignored.printStackTrace(); } pair.show(); return pair; } catch (IOException e) { throw new RuntimeException(e); // Can't happen. } }
Example #2
Source Project: bisq Author: bisq-network File: TradesChartsView.java License: GNU Affero General Public License v3.0 | 6 votes |
private void layout() { UserThread.runAfter(() -> { double available; if (root.getParent() instanceof Pane) available = ((Pane) root.getParent()).getHeight(); else available = root.getHeight(); available = available - volumeChartPane.getHeight() - toolBox.getHeight() - nrOfTradeStatisticsLabel.getHeight() - 75; if (priceChart.isManaged()) available = available - priceChartPane.getHeight(); else available = available + 10; tableView.setPrefHeight(available); }, 100, TimeUnit.MILLISECONDS); }
Example #3
Source Project: trex-stateless-gui Author: cisco-system-traffic-generator File: PortHardwareCounters.java License: Apache License 2.0 | 6 votes |
private void update() { try { if (savedXStatsNames == null) { savedXStatsNames = ConnectionManager.getInstance().sendPortXStatsNamesRequest(port); } String xStatsValues = ConnectionManager.getInstance().sendPortXStatsValuesRequest(port); Map<String, Long> loadedXStatsList = Util.getXStatsFromJSONString(savedXStatsNames, xStatsValues); port.setXstats(loadedXStatsList); Pane pane = statsTableGenerator.generateXStatPane(true, port, statXTableNotEmpty.isSelected(), statXTableFilter.getText(), resetCountersRequested); statXTableContainer.setContent(pane); statXTableContainer.setVisible(true); if (resetCountersRequested) { resetCountersRequested = false; } } catch (Exception ignored) { } }
Example #4
Source Project: charts Author: HanSolo File: XYZPane.java License: Apache License 2.0 | 6 votes |
private void initGraphics() { if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) { if (getPrefWidth() > 0 && getPrefHeight() > 0) { setPrefSize(getPrefWidth(), getPrefHeight()); } else { setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } getStyleClass().setAll("chart", "xyz-chart"); canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); ctx = canvas.getGraphicsContext2D(); pane = new Pane(canvas); getChildren().setAll(pane); }
Example #5
Source Project: desktoppanefx Author: kordamp File: TitleBar.java License: Apache License 2.0 | 6 votes |
private Pane makeTitlePane(String title) { HBox hbLeft = new HBox(); hbLeft.setSpacing(10d); lblTitle = new Label(); lblTitle.textProperty().bind(titleProperty()); setTitle(title); lblTitle.getStyleClass().add("internal-window-titlebar-title"); if (icon != null) { hbLeft.getChildren().add(icon); } hbLeft.getChildren().add(lblTitle); hbLeft.setAlignment(Pos.CENTER_LEFT); AnchorPane.setLeftAnchor(hbLeft, 10d); AnchorPane.setBottomAnchor(hbLeft, 0d); AnchorPane.setRightAnchor(hbLeft, 20d); AnchorPane.setTopAnchor(hbLeft, 0d); return hbLeft; }
Example #6
Source Project: FXTutorials Author: AlmasB File: LoadingScreenDemo.java License: MIT License | 6 votes |
@Override public void start(Stage primaryStage) throws Exception { FXMLLoader loader = new FXMLLoader(getClass().getResource("ui.fxml")); loader.setController(this); Pane root = loader.load(); primaryStage.setScene(new Scene(root)); primaryStage.show(); progressBar.progressProperty().bind(task.progressProperty()); loadingCircleAnimation.play(); Thread t = new Thread(task); t.start(); }
Example #7
Source Project: exit_code_java Author: TheCyaniteProject File: Plugin.java License: GNU General Public License v3.0 | 6 votes |
public static void createAppWindow() { //Create a new window WindowBuilder window = new WindowBuilder("jSnake"); window.setPrefSize(450, 350); // Window Size (Width, height) window.setProcessName("jsnake.app"); //App Pane browserRoot = new Pane(); window.setCenter(browserRoot); WebView browser = new WebView(); browser.prefWidthProperty().bind(browserRoot.widthProperty()); browser.prefHeightProperty().bind(browserRoot.heightProperty()); browserRoot.getChildren().add(browser); WebEngine webEngine = browser.getEngine(); try { webEngine.load((Plugin.class.getResource("/web/index.html")).toString()); } catch(Exception e) {} //Spawn the window window.spawnWindow(); window.placeApp(); }
Example #8
Source Project: phoebus Author: ControlSystemStudio File: XYPlotRepresentation.java License: Eclipse Public License 1.0 | 6 votes |
@Override public Pane createJFXNode() throws Exception { // Plot is only active in runtime mode, not edit mode plot = new RTValuePlot(! toolkit.isEditMode()); plot.setUpdateThrottle(Preferences.plot_update_delay, TimeUnit.MILLISECONDS); plot.showToolbar(false); plot.showCrosshair(false); plot.setManaged(false); // Create PlotMarkers once. Not allowing adding/removing them at runtime if (! toolkit.isEditMode()) for (MarkerProperty marker : model_widget.propMarkers().getValue()) createMarker(marker); // Add button to reset ranges of X and Y axes to the values when plot was first rendered. Button resetAxisRanges = plot.addToolItem(JFXUtil.getIcon("reset_axis_ranges.png"), Messages.Reset_Axis_Ranges); resetAxisRanges.setOnMouseClicked(me -> { plot.resetAxisRanges(); }); return plot; }
Example #9
Source Project: thundernetwork Author: matsjj File: GuiUtils.java License: GNU Affero General Public License v3.0 | 6 votes |
public static void runAlert(BiConsumer<Stage, AlertWindowController> setup) { try { // JavaFX2 doesn't actually have a standard alert template. Instead the Scene Builder app will create FXML // files for an alert window for you, and then you customise it as you see fit. I guess it makes sense in // an odd sort of way. Stage dialogStage = new Stage(); dialogStage.initModality(Modality.APPLICATION_MODAL); FXMLLoader loader = new FXMLLoader(GuiUtils.class.getResource("alert.fxml")); Pane pane = loader.load(); AlertWindowController controller = loader.getController(); setup.accept(dialogStage, controller); dialogStage.setScene(new Scene(pane)); dialogStage.showAndWait(); } catch (IOException e) { // We crashed whilst trying to show the alert dialog (this should never happen). Give up! throw new RuntimeException(e); } }
Example #10
Source Project: UndoFX Author: FXMisc File: CircleProperties.java License: BSD 2-Clause "Simplified" License | 6 votes |
@Override public void start(Stage primaryStage) { Pane pane = new Pane(); pane.setPrefWidth(400); pane.setPrefHeight(400); pane.getChildren().add(circle); HBox undoPanel = new HBox(20.0, undoBtn, redoBtn, saveBtn); VBox root = new VBox(10.0, pane, labeled("Color", colorPicker), labeled("Radius", radius), labeled("X", centerX), labeled("Y", centerY), undoPanel); root.setAlignment(Pos.CENTER); root.setFillWidth(false); Scene scene = new Scene(root); primaryStage.setScene(scene); primaryStage.show(); }
Example #11
Source Project: Cardshifter Author: Cardshifter File: DeckBuilderWindow.java License: Apache License 2.0 | 6 votes |
private void displayActiveDeck() { this.activeDeckBox.getChildren().clear(); List<String> sortedKeys = new ArrayList<>(this.activeDeckConfig.getChosen().keySet()); Collections.sort(sortedKeys); for (String cardId : sortedKeys) { if (!cardList.containsKey(cardId)) { activeDeckConfig.setChosen(cardId, 0); continue; } DeckCardController card = new DeckCardController(this.cardList.get(cardId), this.activeDeckConfig.getChosen().get(cardId)); Pane cardPane = card.getRootPane(); cardPane.setOnMouseClicked(e -> {this.removeCardFromDeck(e, cardId);}); this.activeDeckBox.getChildren().add(cardPane); } this.cardCountLabel.setText(String.format("%d / %d", this.activeDeckConfig.total(), this.activeDeckConfig.getMaxSize())); }
Example #12
Source Project: openchemlib-js Author: cheminfo File: MoleculeViewSkin.java License: BSD 3-Clause "New" or "Revised" License | 6 votes |
private void releaseGlassPane() { dragCanvas.setVisible(false); dragCanvas = null; if (glassPane != null) { if (rootNode.getScene() != null) { final Parent parent = rootNode.getScene().getRoot(); if (parent instanceof Pane) { Pane p = (Pane) parent; p.getChildren().remove(glassPane); glassPane.setOnDragOver(null); glassPane.setOnDragDropped(null); glassPane = null; } } } }
Example #13
Source Project: Motion_Profile_Generator Author: vannaka File: MainApp.java License: MIT License | 6 votes |
@Override public void start( Stage primaryStage ) { try { Pane root = FXMLLoader.load( getClass().getResource("/com/mammen/ui/javafx/main/MainUI.fxml") ); root.autosize(); primaryStage.setScene( new Scene( root ) ); primaryStage.sizeToScene(); primaryStage.setTitle("Motion Profile Generator"); primaryStage.setMinWidth( 1280 ); //1170 primaryStage.setMinHeight( 720 ); //790 primaryStage.setResizable( true ); primaryStage.show(); } catch( Exception e ) { e.printStackTrace(); } }
Example #14
Source Project: mars-sim Author: mars-sim File: MainScene.java License: GNU General Public License v3.0 | 6 votes |
/** * Create the desktop swing node */ private void createDesktopNode() { // Create group to hold swingNode which in turns holds the Swing desktop desktopNode = new SwingNode(); // desktopNode.setStyle("-fx-background-color: black; "); desktop = new MainDesktopPane(this); desktopNode.setStyle("-fx-background-color: transparent; -fx-border-color: black; "); desktopPane = new Pane(desktopNode); desktopPane.setMaxSize(screen_width - 25, screen_height); // TAB_PANEL_HEIGHT // Add main pane WebPanel mainPane = new WebPanel(new BorderLayout()); mainPane.setSize(screen_width - 25 , screen_height - 15); mainPane.add(desktop, BorderLayout.CENTER); // desktopNode.setContent(mainPane); SwingUtilities.invokeLater(() -> desktopNode.setContent(mainPane)); // desktopNode.requestFocus(); }
Example #15
Source Project: ShootOFF Author: phrack File: ArenaCoursesSlide.java License: GNU General Public License v3.0 | 6 votes |
private Pane buildCoursePanes() { final File coursesDirectory = new File(System.getProperty("shootoff.courses")); final ItemSelectionPane<File> uncategorizedPane = buildCategoryPane(coursesDirectory); coursePanes.getChildren().add(new TitledPane("Uncategorized Courses", uncategorizedPane)); categoryMap.put(coursesDirectory.getPath(), uncategorizedPane); final File[] courseFolders = coursesDirectory.listFiles(FOLDER_FILTER); if (courseFolders != null) { for (final File courseFolder : courseFolders) { coursePanes.getChildren().add(new TitledPane(courseFolder.getName().replaceAll("_", "") + " Courses", buildCategoryPane(courseFolder))); } } else { logger.error("{} does not appear to be a valid course directory", coursesDirectory.getPath()); } return coursePanes; }
Example #16
Source Project: JFoenix Author: jfoenixadmin File: JFXSnackbar.java License: Apache License 2.0 | 5 votes |
public void registerSnackbarContainer(Pane snackbarContainer) { if (snackbarContainer != null) { if (this.snackbarContainer != null) { //since listeners are added the container should be properly registered/unregistered throw new IllegalArgumentException("Snackbar Container already set"); } this.snackbarContainer = snackbarContainer; this.snackbarContainer.getChildren().add(this); this.snackbarContainer.heightProperty().addListener(weakSizeListener); this.snackbarContainer.widthProperty().addListener(weakSizeListener); } }
Example #17
Source Project: FxDock Author: andy-goryachev File: DragAndDropHandler.java License: Apache License 2.0 | 5 votes |
protected static Stage createDragWindow(FxDockPane client) { Window owner = FX.getParentWindow(client); Image im = createDragImage(client); Pane p = new Pane(new ImageView(im)); Stage s = new Stage(StageStyle.TRANSPARENT); s.initOwner(owner); s.setScene(new Scene(p, im.getWidth(), im.getHeight())); s.setOpacity(DRAG_WINDOW_OPACITY); return s; }
Example #18
Source Project: logbook-kai Author: sanaehirotaka File: Deck.java License: MIT License | 5 votes |
@Override protected void updateItem(AppDeck item, boolean empty) { super.updateItem(item, empty); if (!empty) { if (item != null) { Label text = new Label(item.getName()); Pane pane = new Pane(); Button del = new Button("除去"); del.getStyleClass().add("delete"); del.setOnAction(e -> { Alert alert = new Alert(AlertType.INFORMATION); alert.getDialogPane().getStylesheets().add("logbook/gui/application.css"); InternalFXMLLoader.setGlobal(alert.getDialogPane()); alert.initOwner(Deck.this.deckList.getScene().getWindow()); alert.setTitle("編成記録の除去"); alert.setContentText("「" + item.getName() + "」を除去しますか?"); alert.getButtonTypes().clear(); alert.getButtonTypes().addAll(ButtonType.YES, ButtonType.NO); if (alert.showAndWait().orElse(null) == ButtonType.YES) { Deck.this.modified.set(false); Deck.this.deckList.getItems().remove(item); } }); HBox box = new HBox(text, pane, del); HBox.setHgrow(pane, Priority.ALWAYS); this.setGraphic(box); } else { this.setGraphic(null); } } else { this.setGraphic(null); } }
Example #19
Source Project: pcgen Author: PCGen File: RadioChooserDialog.java License: GNU Lesser General Public License v2.1 | 5 votes |
/** * Build up a single columns of buttons * @return pane with radio buttons */ private Pane buildNormalColLayout() { GridPane boxPane = new GridPane(); int numButtons = avaRadioButton.length; for (int row = 0; row < numButtons; ++row) { boxPane.add(avaRadioButton[row], 0, row); } return boxPane; }
Example #20
Source Project: Intro-to-Java-Programming Author: jsquared21 File: Exercise_15_20.java License: MIT License | 5 votes |
@Override // Override the start method in the Application class public void start(Stage primaryStage) { // Create a pane Pane pane = new Pane(); // Create three points and add them to a list Circle p1 = new Circle(50, 100, 5); Circle p2 = new Circle(100, 25, 5); Circle p3 = new Circle(150, 80, 5); ArrayList<Circle> points = new ArrayList<>(); points.add(p1); points.add(p2); points.add(p3); // Place nodes in the pane drawTriangle(pane, points); pane.getChildren().addAll(p1, p2, p3); placeText(pane, points); // Create and register the handle pane.setOnMouseDragged(e -> { for (int i = 0; i < points.size(); i++) { if (points.get(i).contains(e.getX(), e.getY())) { pane.getChildren().clear(); points.get(i).setCenterX(e.getX()); points.get(i).setCenterY(e.getY()); drawTriangle(pane, points); pane.getChildren().addAll(p1, p2, p3); placeText(pane, points); } } }); // Create a scene and place it in the stage Scene scene = new Scene(pane, 200, 200); primaryStage.setTitle("Exercise_15_20"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage }
Example #21
Source Project: constellation Author: constellation-app File: ParameterListInputPane.java License: Apache License 2.0 | 5 votes |
private ParameterItem(final Pane parameterPane) { this.parameterPane = parameterPane; buttonBar = new VBox(); buttonBar.setMinWidth(45); removeItemButton = new Button(null, new ImageView(UserInterfaceIconProvider.CROSS.buildImage(16))); moveUpButton = new Button(null, new ImageView(UserInterfaceIconProvider.CHEVRON_UP.buildImage(16))); moveDownButton = new Button(null, new ImageView(UserInterfaceIconProvider.CHEVRON_DOWN.buildImage(16))); buttonBar.getChildren().addAll(removeItemButton, moveUpButton, moveDownButton); buttonBar.setSpacing(10); getChildren().addAll(parameterPane, buttonBar); HBox.setHgrow(parameterPane, Priority.ALWAYS); }
Example #22
Source Project: ariADDna Author: StnetixDevTeam File: CloudSettingsFactory.java License: Apache License 2.0 | 5 votes |
/** * Generate cloud settings page * @param value name of cloud * @param loaderProvider FXML loader * @return cloud settings page * @throws IOException */ public Node getNode(String value, FXMLLoaderProvider loaderProvider) throws IOException { FXMLLoader fxmlLoader = loaderProvider .get("/com/stentix/ariaddna/desktopgui/fxmlViews/settingsTemplate.fxml"); Pane parent = fxmlLoader.load(); Clouds elem = Clouds.valueOf(value); SettingsTemplateController controller = fxmlLoader.getController(); controller.setHeaders(elem.header, elem.name); controller.setContent(loaderProvider .get("/com/stentix/ariaddna/desktopgui/fxmlViews/cloudSettingsView.fxml").load()); return parent; }
Example #23
Source Project: Schillsaver Author: Valkryst File: MainView.java License: MIT License | 5 votes |
/** * Constructs a new MainView. * * @param model * The model. */ public MainView(final Model model) { initializeComponents(); setComponentTooltips(); final Pane menuBar = createMenuBar(); contentArea = createContentArea(); super.setPane(new VBox(menuBar, contentArea)); super.getPane().setMinSize(512, 512); }
Example #24
Source Project: RichTextFX Author: FXMisc File: StyledTextField.java License: BSD 2-Clause "Simplified" License | 5 votes |
private Node traverse( Parent p, Node from, int dir ) { if ( p == null ) return null; List<Node> nodeList = p.getChildrenUnmodifiable(); int len = nodeList.size(); int neighbor = -1; if ( from != null ) while ( ++neighbor < len && nodeList.get(neighbor) != from ); else if ( dir == 1 ) neighbor = -1; else neighbor = len; for ( neighbor += dir; neighbor > -1 && neighbor < len; neighbor += dir ) { Node target = nodeList.get( neighbor ); if ( target instanceof Pane || target instanceof Group ) { target = traverse( (Parent) target, null, dir ); // down if ( target != null ) return target; } else if ( target.isVisible() && ! target.isDisabled() && target.isFocusTraversable() ) { target.requestFocus(); return target; } } return traverse( p.getParent(), p, dir ); // up }
Example #25
Source Project: erlyberly Author: andytill File: ErlyBerly.java License: GNU General Public License v3.0 | 5 votes |
/** * All I know is pane. */ public static Pane wrapInPane(Node node) { if(node instanceof Pane) return (Pane) node; VBox.setVgrow(node, Priority.ALWAYS); VBox vBox = new VBox(node); return vBox; }
Example #26
Source Project: ET_Redux Author: CIRDLES File: TopsoilPlotEvolution.java License: Apache License 2.0 | 5 votes |
@Override public Pane initializePlotPane() { TopsoilPlotController.setTopsoilPlot(this); Pane topsoilPlotUI = null; try { topsoilPlotUI = FXMLLoader.load(getClass().getResource("TopsoilPlot.fxml")); } catch (IOException iOException) { } return topsoilPlotUI; }
Example #27
Source Project: Cryogen Author: alexhulbert File: Utils.java License: GNU General Public License v2.0 | 5 votes |
private static List<Node> recurse(List<Node> children) { List<Node> output = new ArrayList<Node>(); for (Node obj : children) { if (obj instanceof Pane) { output.addAll(recurse(((Pane)obj).getChildren())); } else { output.add(obj); } } return output; }
Example #28
Source Project: ShootOFF Author: phrack File: Slide.java License: GNU General Public License v3.0 | 5 votes |
private void show(Pane parentContainer, List<Node> slideList, List<Node> savedList) { // Do not show twice if (!savedList.isEmpty()) return; savedList.addAll(parentContainer.getChildren()); parentContainer.getChildren().setAll(slideList); }
Example #29
Source Project: erlyberly Author: andytill File: ErlyBerly.java License: GNU General Public License v3.0 | 5 votes |
/** * Show a new control in the tab pane. The tab is closable. */ public static void showPane(String title, Pane parentControl) { assert Platform.isFxApplicationThread(); Tab newTab; newTab = new Tab(title); newTab.setContent(parentControl); addAndSelectTab(newTab); }
Example #30
Source Project: GreenBits Author: greenaddress File: GuiUtils.java License: GNU General Public License v3.0 | 5 votes |
public static Animation fadeOutAndRemove(Duration duration, Pane parentPane, Node... nodes) { nodes[0].setCache(true); FadeTransition ft = new FadeTransition(duration, nodes[0]); ft.setFromValue(nodes[0].getOpacity()); ft.setToValue(0.0); ft.setOnFinished(actionEvent -> parentPane.getChildren().removeAll(nodes)); ft.play(); return ft; }