“MỌI SỰ CỐ GẮNG CHƯA CHẮC ĐÃ GẶT HÁI ĐƯỢC KẾT QUẢ NHƯNG MỖI KẾT QUẢ ĐẠT ĐƯỢC CHẮC CHẮN LÀ CẢ MỘT QUÁ TRÌNH CỐ GẮNG”

HTMLEditorToolBar

Thứ hai - 11/03/2024 12:23

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ổng số điểm của bài viết là: 0 trong 0 đánh giá

Click để đánh giá bài viết
Thống kê
  • Đang truy cập11
  • Hôm nay2,544
  • Tháng hiện tại84,122
  • Tổng lượt truy cập9,175,665
Bạn đã không sử dụng Site, Bấm vào đây để duy trì trạng thái đăng nhập. Thời gian chờ: 60 giây