Java Code Examples for javafx.scene.layout.BorderPane#setId()

The following examples show how to use javafx.scene.layout.BorderPane#setId() . 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: HelpBox.java    From scenic-view with GNU General Public License v3.0 7 votes vote down vote up
public HelpBox(final String title, final String url, final double x, final double y) {
    final BorderPane pane = new BorderPane();
    pane.setId(StageController.FX_CONNECTOR_BASE_ID + "HelpBox");
    pane.setPrefWidth(SCENE_WIDTH);
    pane.setPrefHeight(SCENE_HEIGHT);
    final ProgressWebView wview = new ProgressWebView();
    wview.setPrefHeight(SCENE_HEIGHT);
    wview.setPrefWidth(SCENE_WIDTH);
    wview.doLoad(url);
    pane.setCenter(wview);
    final Scene scene = new Scene(pane, SCENE_WIDTH, SCENE_HEIGHT); 
    stage = new Stage();
    stage.setTitle(title);
    stage.setScene(scene);
    stage.getIcons().add(HELP_ICON);
    stage.setOnCloseRequest(new EventHandler<WindowEvent>() {

        @Override public void handle(final WindowEvent arg0) {
            DisplayUtils.showWebView(false);
        }
    });
    stage.show();
}
 
Example 2
Source File: PreferencesStage.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override
public Parent getContentPane() {
    BorderPane root = new BorderPane();
    root.getStyleClass().add("preferences-stage");
    root.setId("PreferencesStage");

    FormPane formPane = new FormPane("preferences-stage-form", 3);
    // @formatter:off
    formPane.addFormField("Mouse Trigger: ", mouseTriggerField, mouseTriggerButton)
            .addFormField("Keyboard Trigger: ", keyTriggerField)
            .addFormField("Hide MarathonITE options from view: ", doNotHideMarathonITEBlurbs);
    // @formatter:on

    root.setCenter(formPane);
    root.setBottom(buttonBar);
    return root;
}
 
Example 3
Source File: MarathonFileChooser.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public Parent getContentPane() {
    BorderPane root = new BorderPane();

    root.getStyleClass().add("MarathonFileChooser");
    root.setId("marathon-file-chooser");
    if (doesAllowChildren) {
        if (!fileChooserInfo.isFileCreation()) {
            propertiesView = new AddPropertiesView(new TestPropertiesInfo(fileChooserInfo.getFileToSave()));
            TitledPane titledPane = new TitledPane("Properties", propertiesView);
            centerPane.getChildren().addAll(splitPane, titledPane);
            root.setPrefWidth(540);
            root.setPrefHeight(580);
        } else {
            root.setPrefWidth(540);
            root.setPrefHeight(380);
            centerPane.getChildren().addAll(splitPane);
        }
    } else {
        root.setPrefWidth(540);
        root.setPrefHeight(380);
        centerPane.getChildren().add(childrenListView);
    }
    root.setCenter(centerPane);
    root.setBottom(buttonBar);
    return root;
}
 
Example 4
Source File: FunctionStage.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public Parent getContentPane() {
    BorderPane content = new BorderPane();
    content.getStyleClass().add("function-stage");
    content.setId("functionStage");
    content.setCenter(mainSplitPane);
    content.setBottom(buttonBar);
    content.setPrefSize(700, 500);
    return content;
}
 
Example 5
Source File: MessageStage.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public Parent getContentPane() {
    BorderPane root = new BorderPane();
    root.setId("message-stage");
    root.setCenter(new ScrollPane(textArea));
    root.setBottom(buttonBar);
    return root;
}
 
Example 6
Source File: RunHistoryStage.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public Parent getContentPane() {
    addButtonsToVerticalButtonBar();
    BorderPane content = new BorderPane();
    content.getStyleClass().add("run-history-stage");
    content.setId("RunHistoryStage");
    content.setCenter(historyPane);
    content.setBottom(buttonBar);
    return content;
}
 
Example 7
Source File: CheckListView.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public Parent getContentPane() {
    BorderPane borderPane = new BorderPane();
    borderPane.setId("check-list-input-stage");
    FormPane form = new FormPane("check-list-input-stage-form", 2);
    form.addFormField(labelText, inputTextField);
    borderPane.setCenter(form);
    borderPane.setBottom(buttonBar);
    return borderPane;
}
 
Example 8
Source File: ScenicViewGui.java    From scenic-view with GNU General Public License v3.0 4 votes vote down vote up
private void buildUI() {
    rootBorderPane = new BorderPane();
    rootBorderPane.setId(StageController.FX_CONNECTOR_BASE_ID + "scenic-view");
    
    // search bar
    buildFiltersBox();

    // menubar
    buildMenuBar();

    // main splitpane
    splitPane = new SplitPane();
    splitPane.setId("main-splitpane");

    
    // treeview
    treeView = new ScenegraphTreeView(activeNodeFilters, this);
    treeViewScanningPlaceholder = new VBox(10) {
        {
            ProgressIndicator progress = new ProgressIndicator();
            Label label = new Label("Scanning for JavaFX applications");
            label.getStyleClass().add("scanning-label");
            getChildren().addAll(progress, label);
            
            setAlignment(Pos.CENTER);
            
            treeView.expandedItemCountProperty().addListener(o -> {
                setVisible(treeView.getExpandedItemCount() == 0);
            });
            
        }
    };
    
    StackPane treeViewStackPane = new StackPane(treeView, treeViewScanningPlaceholder);
    treeViewStackPane.setStyle(" -fx-padding: 0");

    treeView.setMaxHeight(Double.MAX_VALUE);
    
    // right side
    detailsTab = new DetailsTab(this, new Consumer<String>() {
        @Override public void accept(String property) {
            ScenicViewGui.this.loadAPI(property);
        }
    });

    animationsTab = new AnimationsTab(this);

    tabPane = new TabPane();
    tabPane.getSelectionModel().selectedItemProperty().addListener((ov, oldValue, newValue) -> updateMenuBar(oldValue, newValue));

    javadocTab = new JavaDocTab(this); 
    
    eventsTab = new EventLogTab(this);
    eventsTab.activeProperty().addListener((ov, oldValue, newValue) -> {
        configuration.setEventLogEnabled(newValue);
        configurationUpdated();
    });
    
    // 3Dom
    threeDOMTab = new ThreeDOMTab(this); 
    
    // CSSFX
    cssfxTab = new CSSFXTab(this);
    
    tabPane.getTabs().addAll(detailsTab, eventsTab, /*animationsTab,*/ javadocTab, threeDOMTab, cssfxTab);
    // /3Dom
    
    Persistence.loadProperty("splitPaneDividerPosition", splitPane, 0.3);

    // putting it all together
    splitPane.getItems().addAll(treeViewStackPane, tabPane);

    rootBorderPane.setCenter(splitPane);
    
    // status bar
    statusBar = new StatusBar();
    
    bottomVBox = new VBox(searchBar, statusBar);

    rootBorderPane.setBottom(bottomVBox);

    Persistence.loadProperty("stageWidth", scenicViewStage, 800);
    Persistence.loadProperty("stageHeight", scenicViewStage, 800);
}
 
Example 9
Source File: InternalWindow.java    From desktoppanefx with Apache License 2.0 4 votes vote down vote up
public void detachOrAttachWindow() {
    setDetached(!isDetached());

    if (isDetached()) {
        fireEvent(new InternalWindowEvent(this, InternalWindowEvent.WINDOW_DETACHING));

        Point2D locationOnScreen = this.localToScreen(0, 0);
        detachedWindow.getScene().getStylesheets().setAll(collectStylesheets());

        captureBounds();

        dp = desktopPane.removeInternalWindow(this);

        double width = contentPane.getWidth();
        double height = titleBar.getHeight() + contentPane.getHeight();
        BorderPane bp = new BorderPane();
        bp.setId(getId());
        bp.getStyleClass().addAll(getStyleClass());

        bp.setMinWidth(getMinWidth());
        bp.setMinHeight(getMinHeight());
        bp.setPrefWidth(width);
        bp.setPrefHeight(height);

        bp.setTop(titleBar);
        bp.setCenter(contentPane);
        detachedWindow.getScene().setRoot(bp);

        detachedWindow.addEventHandler(MouseEvent.MOUSE_PRESSED, windowMousePressed);
        detachedWindow.addEventHandler(MouseEvent.MOUSE_MOVED, windowMouseMoved);
        detachedWindow.addEventHandler(MouseEvent.MOUSE_DRAGGED, windowMouseDragged);

        detachedWindow.setX(locationOnScreen.getX());
        detachedWindow.setY(locationOnScreen.getY());

        fireEvent(new InternalWindowEvent(this, InternalWindowEvent.WINDOW_DETACHED));
        detachedWindow.show();

        if (isMaximized()) {
            maximizeDetachedWindow();
        } else {
            bp.setMaxWidth(getMaxWidth());
            bp.setMaxHeight(getMaxHeight());
        }
    } else {
        fireEvent(new InternalWindowEvent(this, InternalWindowEvent.WINDOW_ATTACHING));
        detachedWindow.hide();
        detachedWindow.removeEventHandler(MouseEvent.MOUSE_PRESSED, windowMousePressed);
        detachedWindow.removeEventHandler(MouseEvent.MOUSE_MOVED, windowMouseMoved);
        detachedWindow.removeEventHandler(MouseEvent.MOUSE_DRAGGED, windowMouseDragged);

        setTop(titleBar);
        setCenter(contentPane);

        captureDetachedWindowBounds();

        setPrefSize(previousWidth, previousHeight);

        Bounds boundsInScreen = dp.localToScreen(dp.getBoundsInLocal());
        previousX = Math.max(previousX - boundsInScreen.getMinX(), 0);
        previousY = Math.max(previousY - boundsInScreen.getMinY(), 0);

        double maxX = boundsInScreen.getMaxX() - boundsInScreen.getMinX();
        if (previousX + previousWidth > maxX) {
            previousX = maxX - previousWidth;
        }

        double maxY = boundsInScreen.getMaxY() - boundsInScreen.getMinY();
        if (previousY + previousHeight > maxY) {
            previousY = maxY - previousHeight;
        }

        fireEvent(new InternalWindowEvent(this, InternalWindowEvent.WINDOW_ATTACHED));
        dp.addInternalWindow(this, new Point2D(previousX, previousY));
    }
}
 
Example 10
Source File: AceEditorPreferencesStage.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
@Override
public Parent getContentPane() {
    BorderPane root = new BorderPane();
    root.getStyleClass().add("ace-editor-preferences-stage");
    root.setId("PreferencesStage");

    FormPane formPane = new FormPane("preferences-stage-form", 2);
    themesCombo = new ComboBox<>();
    List<AceEditorTheme> themes = preferenceInfo.getThemes();
    themesCombo.getItems().addAll(themes);
    themesCombo.getSelectionModel().select(previousTheme);
    themesCombo.valueProperty().addListener((event, o, n) -> preferenceHandler.changeTheme(n));

    kbHandlerCombo = new ComboBox<>();
    kbHandlerCombo.getItems().addAll("ace", "emacs", "vim");
    kbHandlerCombo.getSelectionModel().select(previousKeyboardHandler);
    kbHandlerCombo.valueProperty().addListener((event, o, n) -> preferenceHandler.changeKeyboardHandler(n));

    tabSizeSpinner = new Spinner<Integer>(FXCollections.observableArrayList(2, 4, 8));
    tabSizeSpinner.getValueFactory().setValue(previousTabSize);
    tabSizeSpinner.valueProperty().addListener((event, o, n) -> preferenceHandler.changeTabSize(n));

    fontSizeSpinner = new Spinner<String>(
            FXCollections.observableArrayList("10px", "11px", "12px", "13px", "14px", "16px", "18px", "20px", "22px", "24px"));
    fontSizeSpinner.getValueFactory().setValue(previousFontSize);
    fontSizeSpinner.valueProperty().addListener((event, o, n) -> preferenceHandler.changeFontSize(n));

    tabConversionCheckBox = new CheckBox("Convert tabs to spaces");
    tabConversionCheckBox.setSelected(previousTabConversion);
    tabConversionCheckBox.selectedProperty().addListener((event, o, n) -> preferenceHandler.changeTabConversion(n));

    showLineNumbersCheckBox = new CheckBox("Show line numbers");
    showLineNumbersCheckBox.setSelected(previousShowLineNumbers);
    showLineNumbersCheckBox.selectedProperty().addListener((event, o, n) -> preferenceHandler.changeShowLineNumbers(n));

    showInvisiblesCheckBox = new CheckBox("Show Whitespace");
    showInvisiblesCheckBox.setSelected(previousShowInvisibles);
    showInvisiblesCheckBox.selectedProperty().addListener((event, o, n) -> preferenceHandler.changeShowInvisibles(n));

    // @formatter:off
    formPane.addFormField("Theme", themesCombo)
            .addFormField("Keyboard", kbHandlerCombo)
            .addFormField("Font Size", fontSizeSpinner)
            .addFormField("Tab Size", tabSizeSpinner)
            .addFormField("", tabConversionCheckBox)
            .addFormField("", showLineNumbersCheckBox)
            .addFormField("", showInvisiblesCheckBox);
    // @formatter:on

    root.setCenter(formPane);
    root.setBottom(buttonBar);
    return root;
}