https://wiki.vnoj.io.vn

HTMLEditorToolBar

HTMLEditorToolBar


HTMLEditorToolBar

import javafx.application.Application;
import javafx.application.Platform;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.ToolBar;
import javafx.scene.web.HTMLEditor;
import javafx.stage.Stage;

public class HTMLEditorToolBar extends Application {

    @Override
    public void start(Stage primaryStage) {

        final HTMLEditor editor = new HTMLEditor();

        Scene scene = new Scene(editor);
        primaryStage.setScene(scene);

        printNode(editor);

        primaryStage.show();
    }

    private void printNode(final HTMLEditor editor) {
        Platform.runLater(() -> {

            ToolBar top_toolbar = (ToolBar) editor.lookup(".top-toolbar");
            ToolBar bottom_toolbar = (ToolBar) editor.lookup(".bottom-toolbar");

            ObservableList<Node> nodes_top_toolbar = top_toolbar.getItems();
            ObservableList<Node> nodes_bottom_toolbar = bottom_toolbar.getItems();

            for (Node node : nodes_top_toolbar) {
                System.out.println(node);
            }

            for (Node node : nodes_bottom_toolbar) {
                System.out.println(node);
            }
        });
    }

    public static void main(String[] args) {
        launch(args);
    }
}

- Kết quả:

 

Tải về