Java Code Examples for javafx.scene.Node#setVisible()
The following examples show how to use
javafx.scene.Node#setVisible() .
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: WhitespaceOverlayFactory.java From markdown-writer-fx with BSD 2-Clause "Simplified" License | 6 votes |
@Override void layoutOverlayNodes(int paragraphIndex, List<Node> nodes) { Insets insets = getInsets(); double leftInsets = insets.getLeft(); double topInsets = insets.getTop(); // all paragraphs except last one have line separators boolean showEOL = (paragraphIndex < getTextArea().getParagraphs().size() - 1); Node eolNode = nodes.get(nodes.size() - 1); if (eolNode.isVisible() != showEOL) eolNode.setVisible(showEOL); for (Node node : nodes) { Range range = (Range) node.getUserData(); Rectangle2D bounds = getBounds(range.start, range.end); node.setLayoutX(leftInsets + (node == eolNode ? bounds.getMaxX() : bounds.getMinX())); node.setLayoutY(topInsets + bounds.getMinY()); } }
Example 2
Source File: TargetIO.java From ShootOFF with GNU General Public License v3.0 | 6 votes |
private static Group processVisualTags(List<Node> regions) { final Group targetGroup = new Group(); for (final Node node : regions) { final TargetRegion region = (TargetRegion) node; if (region.tagExists(TargetView.TAG_VISIBLE) && !Boolean.parseBoolean(region.getTag(TargetView.TAG_VISIBLE))) { node.setVisible(false); } if (region.getType() != RegionType.IMAGE) { if (region.tagExists(TargetView.TAG_OPACITY)) { node.setOpacity(Double.parseDouble(region.getTag(TargetView.TAG_OPACITY))); } else { node.setOpacity(DEFAULT_OPACITY); } } targetGroup.getChildren().add(node); } return targetGroup; }
Example 3
Source File: JFXNodesList.java From JFoenix with Apache License 2.0 | 6 votes |
private void initChild(Node node, int index, BiFunction<Boolean, Duration, Collection<KeyFrame>> animationFramesFunction, boolean addTriggerListener) { if (index > 0) { initNode(node); node.setVisible(false); } else { if (addTriggerListener) { if (node instanceof Button) { node.addEventHandler(ActionEvent.ACTION, event -> animateList()); } else { node.addEventHandler(MouseEvent.MOUSE_CLICKED, event-> animateList()); } } node.getStyleClass().add("trigger-node"); node.setVisible(true); } if (animationFramesFunction == null && index != 0) { animationFramesFunction = initDefaultAnimation(node); } else if (animationFramesFunction == null && index == 0) { animationFramesFunction = (aBoolean, duration) -> new ArrayList<>(); } animationsMap.put(node, animationFramesFunction); }
Example 4
Source File: JFXTreeTableCellSkin.java From JFoenix with Apache License 2.0 | 6 votes |
private void updateDisclosureNode() { Node disclosureNode = ((JFXTreeTableCell<S, T>) getSkinnable()).getDisclosureNode(); if (disclosureNode != null) { TreeItem<S> item = getSkinnable().getTreeTableRow().getTreeItem(); final S value = item == null ? null : item.getValue(); boolean disclosureVisible = value != null && !item.isLeaf() && value instanceof RecursiveTreeObject && ((RecursiveTreeObject) value).getGroupedColumn() == getSkinnable().getTableColumn(); disclosureNode.setVisible(disclosureVisible); if (!disclosureVisible) { getChildren().remove(disclosureNode); } else if (disclosureNode.getParent() == null) { getChildren().add(disclosureNode); disclosureNode.toFront(); } else { disclosureNode.toBack(); } if (disclosureNode.getScene() != null) { disclosureNode.applyCss(); } } }
Example 5
Source File: ConfigController.java From houdoku with MIT License | 6 votes |
/** * Update the content pane using the selected item in the list. */ private void updateContent() { HBox selected_item = listView.getSelectionModel().getSelectedItem(); Text selected_text = (Text) selected_item.getChildren().get(1); for (Node node : configContentContainer.getChildren()) { boolean matches_clicked = node.getUserData().toString().equals(selected_text.getText()); node.setVisible(matches_clicked); node.setManaged(matches_clicked); } }
Example 6
Source File: CellListManager.java From Flowless with BSD 2-Clause "Simplified" License | 6 votes |
private C cellForItem(T item) { C cell = cellPool.getCell(item); // apply CSS when the cell is first added to the scene Node node = cell.getNode(); EventStreams.nonNullValuesOf(node.sceneProperty()) .subscribeForOne(scene -> { node.applyCss(); }); // Make cell initially invisible. // It will be made visible when it is positioned. node.setVisible(false); if (cell.isReusable()) { // if cell is reused i think adding event handler // would cause resource leakage. node.setOnScroll(this::pushScrollEvent); node.setOnScrollStarted(this::pushScrollEvent); node.setOnScrollFinished(this::pushScrollEvent); } else { node.addEventHandler(ScrollEvent.ANY, this::pushScrollEvent); } return cell; }
Example 7
Source File: MainActivity.java From ApkToolPlus with Apache License 2.0 | 5 votes |
/** * 跳到指定页面 * * @param pageIndex 页面索引,从0开始 */ private void toPage(Integer pageIndex) { ListIterator<Node> nodeListIterator = groupPages.getChildren().listIterator(); for (Integer i = 0; nodeListIterator.hasNext(); ++i) { Node node = nodeListIterator.next(); node.setVisible(i.equals(pageIndex)); } }
Example 8
Source File: CircularProgressIndicator.java From mars-sim with GNU General Public License v3.0 | 5 votes |
private void manageNode(final Node NODE, final boolean MANAGED) { if (MANAGED) { NODE.setManaged(true); NODE.setVisible(true); } else { NODE.setVisible(false); NODE.setManaged(false); } }
Example 9
Source File: CircularProgressIndicator.java From mars-sim with GNU General Public License v3.0 | 5 votes |
private void manageNode(final Node NODE, final boolean MANAGED) { if (MANAGED) { NODE.setManaged(true); NODE.setVisible(true); } else { NODE.setVisible(false); NODE.setManaged(false); } }
Example 10
Source File: PoiLayer.java From maps with GNU General Public License v3.0 | 5 votes |
@Override protected void layoutLayer() { for (Pair<MapPoint, Node> candidate : points) { MapPoint point = candidate.getKey(); Node icon = candidate.getValue(); Point2D mapPoint = getMapPoint(point.getLatitude(), point.getLongitude()); icon.setVisible(true); icon.setTranslateX(mapPoint.getX()); icon.setTranslateY(mapPoint.getY()); } }
Example 11
Source File: HangmanMain.java From FXTutorials with MIT License | 5 votes |
public void takeAwayLife() { for (Node n : getChildren()) { if (!n.isVisible()) { n.setVisible(true); lives.set(lives.get() - 1); break; } } }
Example 12
Source File: GemOverlayBeta_Controller.java From Path-of-Leveling with MIT License | 5 votes |
public void initPanel(){ for(Node n : rootSwapPane.getChildren()) n.setVisible(false); rootSwapPane.getChildren().get(0).setVisible(true); activePanel = 0; maxPages = rootSwapPane.getChildren().size(); pagination.setText(activePanel+1 + "/" + maxPages); mainGem.setText(titles.get(activePanel)); }
Example 13
Source File: Helper.java From Medusa with Apache License 2.0 | 4 votes |
public static final void enableNode(final Node NODE, final boolean ENABLE) { NODE.setManaged(ENABLE); NODE.setVisible(ENABLE); }
Example 14
Source File: ShowerHider.java From AsciidocFX with Apache License 2.0 | 4 votes |
private void makeVisible(Node node) { node.setVisible(true); node.setManaged(true); }
Example 15
Source File: Helper.java From tilesfx with Apache License 2.0 | 4 votes |
public static final void fitNodeWidth(final Node NODE, final double MAX_WIDTH) { NODE.setVisible(NODE.getLayoutBounds().getWidth() < MAX_WIDTH); //enableNode(NODE, NODE.getLayoutBounds().getWidth() < MAX_WIDTH); }
Example 16
Source File: Helper.java From charts with Apache License 2.0 | 4 votes |
public static final void enableNode(final Node NODE, final boolean ENABLE) { NODE.setVisible(ENABLE); NODE.setManaged(ENABLE); }
Example 17
Source File: ActionsDialog.java From phoebus with Eclipse Public License 1.0 | 4 votes |
/** @param details StackPane * @param active Child pane to show, all others are hidden */ private void selectStackPane(final StackPane details, final GridPane active) { for (Node pane : details.getChildren()) pane.setVisible(pane == active); }
Example 18
Source File: MainViewController.java From examples-javafx-repos1 with Apache License 2.0 | 4 votes |
private void applySecurity(Scene s, UserSecurity security, Node n) { if( n == null ) return; if( n.getProperties().containsKey(NodePropertiesKeyType.commandType) ) { // // This is a Node that should have security applied // CommandType command = (CommandType) n.getProperties().get(NodePropertiesKeyType.commandType ); AccessType access = security.getAccess(command); if( log.isDebugEnabled() ) { log.debug("[APPLY] command={}, access={}", command, access); } switch( security.getAccess(command) ) { case SHOW: n.setVisible(true); n.setDisable(false); n.setManaged(true); break; case HIDE: n.setVisible(false); n.setDisable(true); n.setManaged(false); break; case DISABLE: n.setVisible(true); n.setDisable(true); n.setManaged(true); break; } } // // Menus and MenuItems are not Nodes // if( n instanceof MenuBar ) { MenuBar mb = (MenuBar)n; for( Menu toplevel : mb.getMenus() ) { applySecurity( s, security, toplevel ); } } if( n instanceof Parent) { Parent p = (Parent)n; for( Node childNode : p.getChildrenUnmodifiable() ) { applySecurity( s, security, childNode ); } p.layout(); } }
Example 19
Source File: Helper.java From OEE-Designer with MIT License | 4 votes |
public static final void enableNode(final Node NODE, final boolean ENABLE) { NODE.setManaged(ENABLE); NODE.setVisible(ENABLE); }
Example 20
Source File: HistoryDialog.java From PreferencesFX with Apache License 2.0 | 3 votes |
/** * Instantiates a close button and makes it invisible. * Dialog requires at least one button to close the dialog window. * * @see <a href="https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/Dialog.html"> * javafx.scene.control.Dialog</a> * Chapter: Dialog Closing Rules */ private void setupClose() { this.getButtonTypes().add(ButtonType.CLOSE); Node closeButton = dialog.getDialogPane().lookupButton(ButtonType.CLOSE); closeButton.managedProperty().bind(closeButton.visibleProperty()); closeButton.setVisible(false); }