當前位置: 首頁>>代碼示例>>Java>>正文


Java Node類代碼示例

本文整理匯總了Java中javafx.scene.Node的典型用法代碼示例。如果您正苦於以下問題:Java Node類的具體用法?Java Node怎麽用?Java Node使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Node類屬於javafx.scene包,在下文中一共展示了Node類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: loadFX

import javafx.scene.Node; //導入依賴的package包/類
@Test public void loadFX() throws Exception {
    final CountDownLatch cdl = new CountDownLatch(1);
    final CountDownLatch done = new CountDownLatch(1);
    final JFXPanel p = new JFXPanel();
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            Node wv = TestPages.getFX(10, cdl);
            Scene s = new Scene(new Group(wv));
            p.setScene(s);
            done.countDown();
        }
    });
    done.await();
    JFrame f = new JFrame();
    f.getContentPane().add(p);
    f.pack();
    f.setVisible(true);
    cdl.await();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:ComponentsTest.java

示例2: findFields

import javafx.scene.Node; //導入依賴的package包/類
private void findFields(Node current, Node container, List<String> fieldNames) {
    Field[] declaredFields = container.getClass().getDeclaredFields();
    for (Field field : declaredFields) {
        boolean accessible = field.isAccessible();
        try {
            field.setAccessible(true);
            Object o = field.get(container);
            if (o == current) {
                fieldNames.add(field.getName());
            }
        } catch (Throwable t) {
        } finally {
            field.setAccessible(accessible);
        }
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:17,代碼來源:JavaFXElementPropertyAccessor.java

示例3: createFilteredTree

import javafx.scene.Node; //導入依賴的package包/類
private Node createFilteredTree() {
    FilterableTreeItem<Actor> root = getTreeModel();
    root.predicateProperty().bind(Bindings.createObjectBinding(() -> {
        if (filterField.getText() == null || filterField.getText().isEmpty())
            return null;
        return TreeItemPredicate.create(actor -> actor.toString().contains(filterField.getText()));
    }, filterField.textProperty()));

    TreeView<Actor> treeView = new TreeView<>(root);
    treeView.setShowRoot(false);

    TitledPane pane = new TitledPane("Filtered TreeView", treeView);
    pane.setCollapsible(false);
    pane.setMaxHeight(Double.MAX_VALUE);
    return pane;
}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:17,代碼來源:FilterableTreeItemDemo.java

示例4: openHome

import javafx.scene.Node; //導入依賴的package包/類
@FXML
public void openHome(ActionEvent event) throws IOException {
    MyJDBC.createTestDatabase("shabo");
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
    stage.centerOnScreen();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode() + " Made by ShaMaster");
                stage.setScene(hScene);
            }
        }
    });
}
 
開發者ID:dewarian,項目名稱:FYS_T3,代碼行數:23,代碼來源:contactController.java

示例5: updateView

import javafx.scene.Node; //導入依賴的package包/類
private void updateView() {
    getChildren().clear();

    getSkinnable().setVisible(false);
    final Scene scene = getSkinnable().getScene();
    if (scene == null) {
        return;
    }

    for (IntroPane.IntroTarget target : getSkinnable().getTargets()) {
        Set<Node> nodes = target.getParent().lookupAll(target.getId());
        if (nodes != null) {
            nodes.forEach(node -> snapshotNode(scene, node));
        }
    }

    getSkinnable().setVisible(true);
    getSkinnable().requestLayout();
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:20,代碼來源:IntroPaneSkin.java

示例6: rowAdded

import javafx.scene.Node; //導入依賴的package包/類
public void rowAdded() {
    RowPane rp;
    if (curBoxDepth.isEmpty()) {
    	System.out.println("rowAdded! curBoxDepth.isEmpty");
        rp = new RowPane(false, 0);
        rList.add(rp);
        rp.init(this, rList);
        rows.getChildren().add(rp);
    } else {
    	System.out.println("rowAdded!");
        VBox box = curBoxDepth.peek();
        List<Node> children = box.getChildren();
        boolean isFirstRowInBox = (children.isEmpty()) ? true : false;
        rp = new RowPane(isFirstRowInBox, 0);
        rList.add(rp);
        rp.init(this, rList);
        children.add(rp);
    }
    lineNo.getChildren().add(createLabel());
    updateLabelPaddings(rList.size());
    scroll = true;
}
 
開發者ID:nonilole,項目名稱:Conan,代碼行數:23,代碼來源:ProofView.java

示例7: findIndex

import javafx.scene.Node; //導入依賴的package包/類
private int findIndex(Entry<?> entry) {
    int childrenSize = getChildren().size();

    for (int i = 0; i < childrenSize; i++) {
        Node node = getChildren().get(i);
        if (node instanceof AllDayEntryView) {
            AllDayEntryView view = (AllDayEntryView) node;
            Entry<?> viewEntry = view.getEntry();
            if (viewEntry.getStartAsZonedDateTime().isAfter(entry.getStartAsZonedDateTime())) {
                return i;
            }
        }
    }

    return childrenSize;
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:17,代碼來源:AllDayViewSkin.java

示例8: found

import javafx.scene.Node; //導入依賴的package包/類
protected List<IJavaFXElement> found(List<IJavaFXElement> pElements, IJavaFXAgent driver) {
    List<IJavaFXElement> r = new ArrayList<IJavaFXElement>();
    for (IJavaFXElement je : pElements) {
        Node component = je.getComponent();
        if (!(component instanceof Parent)) {
            continue;
        }
        int index = getIndexOfComponentInParent(component);
        if (index < 0) {
            continue;
        }
        Parent parent = component.getParent();
        JFXWindow topContainer = driver.switchTo().getTopContainer();
        ObservableList<Node> children = parent.getChildrenUnmodifiable();
        for (int i = index + 1; i < children.size(); i++) {
            Node c = children.get(i);
            IJavaFXElement je2 = JavaFXElementFactory.createElement(c, driver, driver.switchTo().getTopContainer());
            if (sibling.matchesSelector(je2).size() > 0) {
                IJavaFXElement e = topContainer.addElement(JavaFXElementFactory.createElement(c, driver, topContainer));
                if (!r.contains(e)) {
                    r.add(e);
                }
            }
        }
    }
    return r;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:28,代碼來源:GeneralSiblingSelector.java

示例9: updateDefaultColorIndex

import javafx.scene.Node; //導入依賴的package包/類
private void updateDefaultColorIndex(final MultiAxisChart.Series<X, Y> series) {
	int clearIndex = seriesColorMap.get(series);
	Path seriesLine = (Path) ((Group) series.getNode()).getChildren().get(1);
	Path fillPath = (Path) ((Group) series.getNode()).getChildren().get(0);
	if (seriesLine != null) {
		seriesLine.getStyleClass().remove(DEFAULT_COLOR + clearIndex);
	}
	if (fillPath != null) {
		fillPath.getStyleClass().remove(DEFAULT_COLOR + clearIndex);
	}
	for (int j = 0; j < series.getData().size(); j++) {
		final Node node = series.getData().get(j).getNode();
		if (node != null) {
			node.getStyleClass().remove(DEFAULT_COLOR + clearIndex);
		}
	}
}
 
開發者ID:JKostikiadis,項目名稱:MultiAxisCharts,代碼行數:18,代碼來源:MultiAxisAreaChart.java

示例10: createIconContent

import javafx.scene.Node; //導入依賴的package包/類
public static Node createIconContent() {
    StackPane sp = new StackPane();
    VBox vbox = new VBox(3);
    vbox.setAlignment(Pos.CENTER);
    vbox.setPadding(new Insets(5, 5, 5, 5));

    Rectangle rectangle = new Rectangle(32, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    vbox.setPrefSize(rectangle.getWidth(), rectangle.getHeight());
    Rectangle r1 = new Rectangle(18, 14, Color.web("#1c89f4"));
    Rectangle r2 = new Rectangle(18, 14, Color.web("#349b00"));
    Rectangle r3 = new Rectangle(18, 20, Color.web("#349b00"));

    vbox.getChildren().addAll(r1, r2, r3);
    sp.getChildren().addAll(rectangle, vbox);
    return new Group(sp);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:18,代碼來源:VBoxSample.java

示例11: clicknext

import javafx.scene.Node; //導入依賴的package包/類
public void clicknext(ActionEvent event) throws IOException {
	if(edit.getText().equalsIgnoreCase("Edit"))
	{
	Stage stage = new Stage();
	Parent root = FXMLLoader.load(getClass().getResource("/template/TemplateFXML.fxml"));
	Scene scene = new Scene(root);
	scene.getStylesheets().add(getClass().getResource("/template/TemplateCSS.css").toExternalForm());
	stage.setTitle("IDBuilderFX - Select Template");
	Stage currstage = (Stage) ((Node) event.getSource()).getScene().getWindow();
	currstage.close();
	stage.setScene(scene);
	stage.resizableProperty().setValue(Boolean.FALSE);
	stage.show();
	}
	else
		warnLabel.setText("Please Save First....");
}
 
開發者ID:djdivix,項目名稱:IDBuilderFX,代碼行數:18,代碼來源:ViewSingleParsedController.java

示例12: okAction

import javafx.scene.Node; //導入依賴的package包/類
/**
 * The action to fire when the user clicks the "Ok" button.
 * <p>
 * Sets the mapped genome in {@link GraphAnnotation} to the value in the genome choice textfield.
 *
 * @param actionEvent the {@link ActionEvent}
 */
@FXML
void okAction(final ActionEvent actionEvent) {
    if (genomeChoice.getText().isEmpty()) {
        (new WarningDialogue("Please select a mapping.")).show();
        return;
    }

    try {
        graphAnnotation.setMappedGenome(genomeChoice.getText());
    } catch (final IOException e) {
        LOGGER.error("Unable to build an index for genome " + genomeChoice.getText() + ".", e);
        new ErrorDialogue(e).show();
    }

    final Node source = (Node) actionEvent.getSource();
    source.getScene().getWindow().hide();

    actionEvent.consume();

    LOGGER.info("Genome " + gffGenome.getText() + " from GFF will be mapped onto " + genomeChoice.getText() + ".");
}
 
開發者ID:ProgrammingLife2017,項目名稱:hygene,代碼行數:29,代碼來源:GenomeMappingController.java

示例13: addContinuousPressHandler

import javafx.scene.Node; //導入依賴的package包/類
/**
 * Add an event handler to a node will trigger continuously trigger at a given interval while the button is
 * being pressed.
 *
 * @param node     the {@link Node}
 * @param holdTime interval time
 * @param handler  the handler
 */
private void addContinuousPressHandler(final Node node, final Duration holdTime,
                                       final EventHandler<MouseEvent> handler) {
    final Wrapper<MouseEvent> eventWrapper = new Wrapper<>();

    final PauseTransition holdTimer = new PauseTransition(holdTime);
    holdTimer.setOnFinished(event -> {
        handler.handle(eventWrapper.content);
        holdTimer.playFromStart();
    });

    node.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
        eventWrapper.content = event;
        holdTimer.playFromStart();
    });
    node.addEventHandler(MouseEvent.MOUSE_RELEASED, event -> holdTimer.stop());
    node.addEventHandler(MouseEvent.DRAG_DETECTED, event -> holdTimer.stop());
}
 
開發者ID:ProgrammingLife2017,項目名稱:hygene,代碼行數:26,代碼來源:GraphNavigationController.java

示例14: createEmojiNode

import javafx.scene.Node; //導入依賴的package包/類
/**
 * 創建emoji圖片節點
 *
 * @param emoji
 *            emoji
 * @param size
 *            圖片顯示大小
 * @param pad
 *            圖片間距
 * @param isCursor
 *            是否需要圖片光標及鼠標處理事件
 * @return
 */
public static Node createEmojiNode(Emoji emoji, int size, int pad) {
	// 將表情放到stackpane中
	StackPane stackPane = new StackPane();
	stackPane.setMaxSize(size, size);
	stackPane.setPrefSize(size, size);
	stackPane.setMinSize(size, size);
	stackPane.setPadding(new Insets(pad));
	ImageView imageView = new ImageView();
	imageView.setFitWidth(size);
	imageView.setFitHeight(size);
	imageView.setImage(ImageCache.getInstance().getImage(getEmojiImagePath(emoji.getHex())));
	stackPane.getChildren().add(imageView);

	return stackPane;
}
 
開發者ID:Laity000,項目名稱:ChatRoom-JavaFX,代碼行數:29,代碼來源:EmojiDisplayer.java

示例15: calculateAndRotatoNodes

import javafx.scene.Node; //導入依賴的package包/類
private void calculateAndRotatoNodes(List<Node> nodes, double alp, double bet, double gam) {
    double A11 = Math.cos(alp) * Math.cos(gam);
    double A12 = Math.cos(bet) * Math.sin(alp) + Math.cos(alp) * Math.sin(bet) * Math.sin(gam);
    double A13 = Math.sin(alp) * Math.sin(bet) - Math.cos(alp) * Math.cos(bet) * Math.sin(gam);
    double A21 = -Math.cos(gam) * Math.sin(alp);
    double A22 = Math.cos(alp) * Math.cos(bet) - Math.sin(alp) * Math.sin(bet) * Math.sin(gam);
    double A23 = Math.cos(alp) * Math.sin(bet) + Math.cos(bet) * Math.sin(alp) * Math.sin(gam);
    double A31 = Math.sin(gam);
    double A32 = -Math.cos(gam) * Math.sin(bet);
    double A33 = Math.cos(bet) * Math.cos(gam);

    double d = Math.acos((A11 + A22 + A33 - 1d) / 2d);
    if (!ObjectUtils.equalsDoublePrecision(d, 0.0)) {
        double den = 2d * Math.sin(d);
        Point3D p = new Point3D((A32 - A23) / den, (A13 - A31) / den, (A21 - A12) / den);
        for (Node node : nodes) {
            node.setRotationAxis(p);
            node.setRotate(Math.toDegrees(d));
        }
    }
}
 
開發者ID:adihubba,項目名稱:javafx-3d-surface-chart,代碼行數:22,代碼來源:Mesh3DChartPanel.java


注:本文中的javafx.scene.Node類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。