Example usage for javafx.scene.layout AnchorPane getStylesheets

List of usage examples for javafx.scene.layout AnchorPane getStylesheets

Introduction

In this page you can find the example usage for javafx.scene.layout AnchorPane getStylesheets.

Prototype

public final ObservableList<String> getStylesheets() 

Source Link

Document

Gets an observable list of string URLs linking to the stylesheets to use with this Parent's contents.

Usage

From source file:ijfx.ui.canvas.FxCanvasTester.java

@Override
public void start(Stage primaryStage) {

    final SCIFIO scifio = new SCIFIO();
    MenuBar menuBar = new MenuBar();
    InputControl parameterInput = null;//from  w  w w  .j a v a2 s . c  o m
    try {
        System.setProperty("imagej.legacy.sync", "true");
        //reader.getContext().inject(this);
        ImageJ imagej = new ImageJ();
        context = imagej.getContext();
        CommandInfo command = imagej.command().getCommand(GaussianBlur.class);

        CommandModuleItem input = command.getInput("sigma");
        Class<?> type = input.getType();
        if (type == double.class) {
            type = Double.class;
        }

        context.inject(this);

        GaussianBlur module = new GaussianBlur();

        imagej.ui().showUI();

        //reader = scifio.initializer().initializeReader("./stack.tif");
        commandService.run(OpenFile.class, true, new HashMap<String, Object>());

        menuBar = new MenuBar();
        menuService.createMenus(new FxMenuCreator(), menuBar);
        ObjectMapper mapper = new ObjectMapper();
        SimpleModule simpleModule = new SimpleModule("ModuleSerializer");
        // simpleModule.addSerializer(ModuleItem<?>.class,new ModuleItemSerializer());
        simpleModule.addSerializer(ModuleInfo.class, new ModuleSerializer());
        simpleModule.addSerializer(ModuleItem.class, new ModuleItemSerializer());
        mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
        mapper.enable(SerializationFeature.INDENT_OUTPUT);
        mapper.registerModule(simpleModule);

        mapper.writeValue(new File("modules.json"), moduleService.getModules());

    } catch (Exception ex) {
        ImageJFX.getLogger();
    }

    //imageView.fitImageToScreen();
    Button reset = new Button("Reset");

    reset.setOnAction(event -> update());

    BorderPane pane = new BorderPane();

    Button test = new Button("Test");

    AnchorPane root = new AnchorPane();
    root.getChildren().add(pane);
    root.getStylesheets().add(ArcMenu.class.getResource("arc-default.css").toExternalForm());
    root.getStylesheets().add(ImageJFX.class.getResource(("flatterfx.css")).toExternalForm());
    AnchorPane.setTopAnchor(pane, 0.0);
    AnchorPane.setBottomAnchor(pane, 0.0);
    AnchorPane.setLeftAnchor(pane, 0.0);
    AnchorPane.setRightAnchor(pane, 0.0);
    pane.setTop(menuBar);

    HBox vbox = new HBox();
    vbox.getChildren().addAll(reset, test, parameterInput);
    vbox.setSpacing(10);
    vbox.setPadding(new Insets(10, 10, 10, 10));
    // update();
    pane.setCenter(ImageWindowContainer.getInstance());
    // pane.setPrefSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
    pane.setBottom(vbox);

    Scene scene = new Scene(root, 600, 600);

    test.setOnAction(event -> {

        test();
    });

    primaryStage.setTitle("ImageCanvasTest");
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:main.Content.java

public void showTreeView() {
    try {//from  ww w.ja  v a  2s  . c o m
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(Main.class.getResource("view/TreePane.fxml"));
        AnchorPane activityPaneOverview = (AnchorPane) loader.load();

        TreeViewController controller = loader.getController();
        ScrollPane scrollPane = new ScrollPane();

        controller.setMainApp(this);
        controller.setTableData(data);
        controller.startTreeView();

        TreeView<String> treeView = controller.getTree();

        scrollPane.setContent(treeView);
        treeView.autosize();

        activityPaneOverview.getStylesheets()
                .add(Main.class.getResource("view/DarkTheme.css").toExternalForm());

        activityPaneOverview.getChildren().add(scrollPane);
        activityPaneOverview.setTopAnchor(scrollPane, 10.0);
        activityPaneOverview.setLeftAnchor(scrollPane, 10.0);
        activityPaneOverview.setRightAnchor(scrollPane, 10.0);
        activityPaneOverview.setBottomAnchor(scrollPane, 10.0);

        scrollPane.setFitToHeight(true);
        scrollPane.setFitToWidth(true);

        rootLayout.setLeft(activityPaneOverview);

        System.out.println("showTreeOveerview u therrit" + index);

    } catch (IOException e) {
        e.printStackTrace();
    }
}