javafx.scene.Parent Java Examples
The following examples show how to use
javafx.scene.Parent.
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 File: Navigator.java From Flowless with BSD 2-Clause "Simplified" License | 6 votes |
@Override protected void layoutChildren() { // invalidate breadth for each cell that has dirty layout int n = cells.getMemoizedCount(); for(int i = 0; i < n; ++i) { int j = cells.indexOfMemoizedItem(i); Node node = cells.get(j).getNode(); if(node instanceof Parent && ((Parent) node).isNeedsLayout()) { sizeTracker.forgetSizeOf(j); } } if(!cells.isEmpty()) { targetPosition.clamp(cells.size()) .accept(this); } currentPosition = getCurrentPosition(); targetPosition = currentPosition; }
Example #2
Source File: App.java From Jupiter with GNU General Public License v3.0 | 6 votes |
/** {@inheritDoc} */ @Override public void start(Stage stage) { try { // load splash Parent root = FXMLLoader.load(getClass().getResource("/jupiter/fxml/Splash.fxml")); // create scene and add styles Scene scene = new Scene(root, 500, 274); scene.getStylesheets().addAll(getClass().getResource("/jupiter/css/splash.css").toExternalForm()); // set stage stage.setScene(scene); stage.setResizable(false); stage.initStyle(StageStyle.UNDECORATED); stage.getIcons().add(Icons.favicon()); stage.toFront(); stage.show(); } catch (IOException e) { e.printStackTrace(); Logger.error("could not load Jupiter GUI"); Jupiter.exit(1); } }
Example #3
Source File: UiUtils.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
/** * Fill a list of components. * * @param container the container * @param node the node */ @FxThread public static void fillComponents(@NotNull final Array<ScreenComponent> container, @NotNull final Node node) { if (node instanceof ScreenComponent) { container.add((ScreenComponent) node); } if (node instanceof SplitPane) { final ObservableList<Node> items = ((SplitPane) node).getItems(); items.forEach(child -> fillComponents(container, child)); } else if (node instanceof TabPane) { final ObservableList<Tab> tabs = ((TabPane) node).getTabs(); tabs.forEach(tab -> fillComponents(container, tab.getContent())); } if (!(node instanceof Parent)) { return; } final ObservableList<Node> nodes = ((Parent) node).getChildrenUnmodifiable(); nodes.forEach(child -> fillComponents(container, child)); }
Example #4
Source File: AnimationApp.java From FXTutorials with MIT License | 6 votes |
private Parent createContent() { Pane root = new Pane(); root.setPrefSize(800, 600); NotificationPane pane = new NotificationPane(200, 600); pane.setTranslateX(800 - 200); Button btn = new Button("Animate"); btn.setOnAction(e -> { pane.animate(); }); root.getChildren().addAll(btn, pane); return root; }
Example #5
Source File: Main.java From Everest with Apache License 2.0 | 6 votes |
@Override public void start(Stage primaryStage) throws Exception { SettingsLoader settingsLoader = new SettingsLoader(); settingsLoader.settingsLoaderThread.join(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/homewindow/HomeWindow.fxml")); Parent homeWindow = loader.load(); Stage dashboardStage = new Stage(); ThemeManager.setTheme(homeWindow); Rectangle2D screenBounds = Screen.getPrimary().getBounds(); dashboardStage.setWidth(screenBounds.getWidth() * 0.83); dashboardStage.setHeight(screenBounds.getHeight() * 0.74); dashboardStage.getIcons().add(new Image(getClass().getResource("/assets/Logo.png").toExternalForm())); dashboardStage.setScene(new Scene(homeWindow)); dashboardStage.setTitle(APP_NAME); dashboardStage.show(); }
Example #6
Source File: RadialMenu.java From Enzo with Apache License 2.0 | 6 votes |
public void show() { if (options.isButtonHideOnSelect() && mainMenuButton.getOpacity() > 0) { return; } if (options.isButtonHideOnSelect() || mainMenuButton.getOpacity() == 0) { mainMenuButton.setScaleX(1.0); mainMenuButton.setScaleY(1.0); cross.setRotate(0); mainMenuButton.setRotate(0); FadeTransition buttonFadeIn = new FadeTransition(); buttonFadeIn.setNode(mainMenuButton); buttonFadeIn.setDuration(Duration.millis(200)); buttonFadeIn.setToValue(options.getButtonAlpha()); buttonFadeIn.play(); } for (Parent node : items.keySet()) { node.setScaleX(1.0); node.setScaleY(1.0); node.setTranslateX(0); node.setTranslateY(0); node.setRotate(0); } }
Example #7
Source File: HiddenSidesPaneSkin.java From chart-fx with Apache License 2.0 | 6 votes |
private boolean hasShowingChild(Node n) { if (n == null) { return false; } if (n.isHover()) { lastHideBlockingNode = n; return true; } try { Method showingMethod = ClassDescriptions.getMethod(n.getClass(), "isShowing"); if (showingMethod != null && (Boolean) showingMethod.invoke(n)) { lastHideBlockingNode = n; return true; } } catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { // do nothing } if (n instanceof Parent) { return ((Parent) n).getChildrenUnmodifiable().stream().anyMatch(this::hasShowingChild); } return false; }
Example #8
Source File: MenuButtonApplication.java From examples-javafx-repos1 with Apache License 2.0 | 6 votes |
@Override public void start(Stage primaryStage) { try { Parent p = FXMLLoader.load(getClass().getResource("/menubutton-fxml/CollegeSelection.fxml")); Scene scene = new Scene(p); primaryStage.setTitle("bekwam.com Menu Button Example"); primaryStage.setScene( scene ); primaryStage.show(); } catch(IOException exc) { logger.error( "error loading fxml", exc ); Alert alert = new Alert(Alert.AlertType.ERROR, "Error loading FXML"); alert.showAndWait(); } }
Example #9
Source File: SingleImageCheck.java From FakeImageDetection with GNU General Public License v3.0 | 6 votes |
@Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("/resources/fxml/singleimage.fxml")); Scene scene = new Scene(root); stage.resizableProperty().setValue(false); stage.setTitle("Single Image Checker"); stage.setScene(scene); stage.show(); CommonUtil.attachIcon(stage); stage.setOnCloseRequest((WindowEvent event) -> { System.exit(0); }); }
Example #10
Source File: MemoryPuzzleApp.java From FXTutorials with MIT License | 6 votes |
private Parent createContent() { Pane root = new Pane(); root.setPrefSize(600, 600); char c = 'A'; List<Tile> tiles = new ArrayList<>(); for (int i = 0; i < NUM_OF_PAIRS; i++) { tiles.add(new Tile(String.valueOf(c))); tiles.add(new Tile(String.valueOf(c))); c++; } Collections.shuffle(tiles); for (int i = 0; i < tiles.size(); i++) { Tile tile = tiles.get(i); tile.setTranslateX(50 * (i % NUM_PER_ROW)); tile.setTranslateY(50 * (i / NUM_PER_ROW)); root.getChildren().add(tile); } return root; }
Example #11
Source File: MapReferenceScaleSample.java From arcgis-runtime-samples-java with Apache License 2.0 | 6 votes |
@Override public void start(Stage stage) throws Exception { // set up the scene FXMLLoader loader = new FXMLLoader(getClass().getResource("/map_reference_scale/main.fxml")); Parent root = loader.load(); controller = loader.getController(); Scene scene = new Scene(root); // set up the stage stage.setTitle("Map Reference Scale Sample"); stage.setWidth(800); stage.setHeight(700); stage.setScene(scene); stage.show(); }
Example #12
Source File: CreateAndSaveKMLFileSample.java From arcgis-runtime-samples-java with Apache License 2.0 | 6 votes |
@Override public void start(Stage stage) throws Exception { // set up the scene FXMLLoader loader = new FXMLLoader(getClass().getResource("/create_and_save_kml_file/main.fxml")); Parent root = loader.load(); controller = loader.getController(); Scene scene = new Scene(root); // set title, size and add scene to stage stage.setTitle("Create and Save KML File"); stage.setWidth(800); stage.setHeight(700); stage.setScene(scene); stage.show(); }
Example #13
Source File: WindowController.java From Image-Cipher with Apache License 2.0 | 6 votes |
@Override public void start(Stage myStage) { Optional<Parent> root = Optional.empty(); try { root = Optional.of(FXMLLoader.load( Main.class.getResource("/views/MainWindow.fxml") )); } catch (IOException e) { logger.error(e); } root.ifPresent(parent -> { Scene scene = new Scene(parent); scene.getStylesheets().add("org/kordamp/bootstrapfx/bootstrapfx.css"); myStage.setMinWidth(900); myStage.setMinHeight(450); myStage.setTitle("Image Cipher"); myStage.setScene(scene); myStage.show(); logger.info("Showing MainWindow"); }); }
Example #14
Source File: DrawingApp.java From FXTutorials with MIT License | 6 votes |
private Parent createContent() { Pane root = new Pane(); root.setPrefSize(800, 600); Canvas canvas = new Canvas(800, 600); g = canvas.getGraphicsContext2D(); AnimationTimer timer = new AnimationTimer() { @Override public void handle(long now) { t += 0.017; draw(); } }; timer.start(); root.getChildren().add(canvas); return root; }
Example #15
Source File: MainController.java From ApkCustomizationTool with Apache License 2.0 | 6 votes |
public Stage getBuildStage() { if (buildStage == null) { try { Parent root = FXMLLoader.load(getClass().getResource("fxml/apk_build.fxml")); buildStage = new Stage(); buildStage.setTitle(Main.TITLE); buildStage.setScene(new Scene(root)); buildStage.initModality(Modality.NONE); buildStage.initStyle(StageStyle.UNIFIED); buildStage.setResizable(false); buildStage.initOwner(Main.stage); buildStage.setX(Main.stage.getX()); buildStage.setY(Main.stage.getY() + Main.stage.getHeight()); buildStage.setOnShown((event) -> { }); } catch (Exception e) { e.printStackTrace(); buildStage = null; } } return buildStage; }
Example #16
Source File: CalibratePatchesBase.java From testing-video with GNU General Public License v3.0 | 6 votes |
protected Parent overlay(Args args) { Color fill = getTextFill(args); TextFlow topLeft = text(fill, getTopLeftText(args), LEFT); TextFlow topCenter = text(fill, getTopCenterText(args), CENTER); TextFlow topRight = text(fill, getTopRightText(args), RIGHT); TextFlow bottomLeft = text(fill, getBottomLeftText(args), LEFT); TextFlow bottomCenter = text(fill, getBottomCenterText(args), CENTER); TextFlow bottomRight = text(fill, getBottomRightText(args), RIGHT); StackPane top = new StackPane(topLeft, topCenter, topRight); StackPane bottom = new StackPane(bottomLeft, bottomCenter, bottomRight); BorderPane.setMargin(top, new Insets(20)); BorderPane.setMargin(bottom, new Insets(20)); BorderPane layout = new BorderPane(); layout.setBackground(EMPTY); layout.setTop(top); layout.setBottom(bottom); return layout; }
Example #17
Source File: ObservableApplication.java From JavaFX-Tutorial-Codes with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("mainScene.fxml")); Scene scene = new Scene(root); stage.setTitle("Genuine Coder"); stage.setScene(scene); stage.show(); }
Example #18
Source File: JiaGuActivity.java From ApkToolPlus with Apache License 2.0 | 5 votes |
@FXML public void clear(){ List<Object> deleteList = new ArrayList<>(); listViewApkList.getItems().forEach((item)->{ Parent node = (Parent) item; ApkItemView controller = (ApkItemView) node.getUserData(); if(!controller.isEncrypting()){ deleteList.add(item); } }); listViewApkList.getItems().removeAll(deleteList); }
Example #19
Source File: EditAreaController.java From SmartCity-ParkingManagement with Apache License 2.0 | 5 votes |
public static void display(final String parkingAreaID) throws IOException, ParseException { //parkingAreaElement = new ParkingArea(parkingAreaID); final Stage window = new Stage(); final Parent editAreaParent = FXMLLoader.load(EditAreaController.class.getResource("EditArea.fxml")); window.initModality(Modality.APPLICATION_MODAL); //window.setTitle("Edit Parking Area: " + parkingAreaElement.getName()); window.setScene(new Scene(editAreaParent)); window.showAndWait(); }
Example #20
Source File: DataAppPreloader.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void handleApplicationNotification(PreloaderNotification info) { if (info instanceof PreloaderHandoverEvent) { // handover from preloader to application final PreloaderHandoverEvent event = (PreloaderHandoverEvent)info; final Parent appRoot = event.getRoot(); // remove race track root.getChildren().remove(raceTrack); // stop simulating progress simulatorTimeline.stop(); // apply application stylsheet to scene preloaderScene.getStylesheets().setAll(event.getCssUrl()); // enable caching for smooth fade appRoot.setCache(true); // make hide appRoot then add it to scene appRoot.setTranslateY(preloaderScene.getHeight()); root.getChildren().add(1,appRoot); // animate fade in app content Timeline fadeOut = new Timeline(); fadeOut.getKeyFrames().addAll( new KeyFrame( Duration.millis(1000), new KeyValue(appRoot.translateYProperty(), 0, Interpolator.EASE_OUT) ), new KeyFrame( Duration.millis(1500), new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { // turn off cache as not need any more appRoot.setCache(false); // done animation so start loading data for (Runnable task: event.getDataLoadingTasks()) { Platform.runLater(task); } } } ) ); fadeOut.play(); } }
Example #21
Source File: PopOver.java From logbook-kai with MIT License | 5 votes |
/** * ポップアップを初期化します * * @param anchorNode アンカーノード * @return ポップアップ */ protected Popup initPopup(Node anchorNode) { Parent node = this.nodeSupplier.apply(anchorNode, this.userData.get(anchorNode)); node.setOnMouseExited(this::setOnMouseExited); this.popup.getScene().setRoot(node); return this.popup; }
Example #22
Source File: FitToViewportAction.java From gef with Eclipse Public License 2.0 | 5 votes |
/** * Returns the {@link InfiniteCanvas} of the viewer where this action is * installed. * * @return The {@link InfiniteCanvas} of the viewer. */ protected InfiniteCanvas getInfiniteCanvas() { Parent canvas = getViewer().getCanvas(); if (canvas instanceof InfiniteCanvas) { return (InfiniteCanvas) canvas; } return null; }
Example #23
Source File: TabsRepresentation.java From phoebus with Eclipse Public License 1.0 | 5 votes |
@Override public TabPane createJFXNode() throws Exception { final TabPane tabs = new TabPane(); // See 'twiddle' below tabs.setStyle("-fx-background-color: lightgray;"); tabs.getStyleClass().add(TabPane.STYLE_CLASS_FLOATING); tabs.setMinSize(TabPane.USE_PREF_SIZE, TabPane.USE_PREF_SIZE); tabs.setTabMinHeight(model_widget.propTabHeight().getValue()); // In edit mode, we want to support 'rubberbanding' inside the active tab. // This means mouse clicks need to be passed up to the 'model_root' // where the rubber band handler can then see them. if (toolkit.isEditMode()) tabs.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> { // As in 'group' widget, only do this when ALT is pressed, // so ALT-rubberband will select inside the tab. // Plain click still directly reaches the child widget in the current tab, // or - if we hit the background of the tab - the tab widget itself. // If we passed any click up to the model root, you could // longer click on widgets inside the tab or the tab itself. if (event.isAltDown()) for (Parent parent = tabs.getParent(); parent != null; parent = parent.getParent()) if (JFXRepresentation.MODEL_ROOT_ID.equals(parent.getId())) { parent.fireEvent(event); break; } }); return tabs; }
Example #24
Source File: DiagnosticWindow.java From MSPaintIDE with MIT License | 5 votes |
public DiagnosticWindow(MainGUI mainGUI, DiagnosticManager diagnosticManager) throws IOException { super(); this.mainGUI = mainGUI; this.diagnosticManager = diagnosticManager; FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("gui/DiagnosticDisplay.fxml")); loader.setController(this); Parent root = loader.load(); ImageView icon = new ImageView(getClass().getClassLoader().getResource("icons/taskbar/ms-paint-logo-colored.png").toString()); icon.setFitHeight(25); icon.setFitWidth(25); JFXDecorator jfxDecorator = new JFXDecorator(this, root, false, true, true); jfxDecorator.setGraphic(icon); jfxDecorator.setTitle("IDE Diagnostics"); Scene scene = new Scene(jfxDecorator); scene.getStylesheets().add("style.css"); setScene(scene); this.mainGUI.getThemeManager().addStage(this); show(); setTitle("IDE Diagnostics"); getIcons().add(new Image(getClass().getClassLoader().getResourceAsStream("ms-paint-logo-taskbar.png"))); this.themeManager = this.mainGUI.getThemeManager().onDarkThemeChange(root, Map.of( "#diagnosticWindow", "dark" )); }
Example #25
Source File: JavaFXElementPropertyAccessor.java From marathonv5 with Apache License 2.0 | 5 votes |
final public List<String> getFieldNames() { List<String> fieldNames = new ArrayList<String>(); Parent container = node.getParent(); while (container != null) { findFields(node, container, fieldNames); container = container.getParent(); } return fieldNames; }
Example #26
Source File: FXMLDocumentController.java From Online-Food-Ordering-System with MIT License | 5 votes |
@FXML public void loginScreen(ActionEvent event) throws Exception { Stage primaryStage =new Stage(); primaryStage.initStyle(StageStyle.UNDECORATED); Parent root =FXMLLoader.load(getClass().getResource("Login.fxml")); Scene scene = new Scene(root); primaryStage.setScene(scene); primaryStage.show(); // Hide this current window (if this is what you want) ((Node)(event.getSource())).getScene().getWindow().hide(); }
Example #27
Source File: GCApp.java From FXTutorials with MIT License | 5 votes |
private Parent createContent() { VBox root = new VBox(10); root.setPrefSize(800, 600); root.setPadding(new Insets(50, 50, 50, 50)); root.getChildren().addAll(makeToolbar(), new Label("EDEN"), edenSpace, new Label("S1"), s1Space, new Label("S2"), s2Space, new Label("OLD"), oldSpace); return root; }
Example #28
Source File: Demo1.java From Enzo with Apache License 2.0 | 5 votes |
private static void calcNoOfNodes(Node node) { if (node instanceof Parent) { if (((Parent) node).getChildrenUnmodifiable().size() != 0) { ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable(); noOfNodes += tempChildren.size(); for (Node n : tempChildren) { calcNoOfNodes(n); //System.out.println(n.getStyleClass().toString()); } } } }
Example #29
Source File: FoodyOrder.java From Online-Food-Ordering-System with MIT License | 5 votes |
@Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("Login.fxml")); stage.initStyle(StageStyle.UNDECORATED); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); }
Example #30
Source File: Demo.java From JFX8CustomControls with Apache License 2.0 | 5 votes |
private static void calcNoOfNodes(Node node) { if (node instanceof Parent) { if (((Parent) node).getChildrenUnmodifiable().size() != 0) { ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable(); noOfNodes += tempChildren.size(); for (Node n : tempChildren) { calcNoOfNodes(n); //System.out.println(n.getStyleClass().toString()); } } } }