Search in sources :

Example 51 with BorderPane

use of javafx.scene.layout.BorderPane in project jgnash by ccavanaugh.

the class TabViewPane method addTab.

public Tab addTab(final Node node, final String description) {
    BorderPane borderPane = new BorderPane();
    TitledPane titledPane = new TitledPane(description, null);
    titledPane.setCollapsible(false);
    titledPane.setExpanded(false);
    titledPane.setFocusTraversable(false);
    titledPane.getStyleClass().add(VIEW_TITLE);
    borderPane.setTop(titledPane);
    borderPane.setCenter(node);
    Tab tab = new Tab();
    tab.setText(description);
    tab.setContent(borderPane);
    getTabs().add(tab);
    return tab;
}
Also used : TitledPane(javafx.scene.control.TitledPane) BorderPane(javafx.scene.layout.BorderPane) Tab(javafx.scene.control.Tab)

Example 52 with BorderPane

use of javafx.scene.layout.BorderPane in project intellij-community by JetBrains.

the class IpnbJfxUtils method createHtmlPanel.

public static JComponent createHtmlPanel(@NotNull final String source, int width) {
    final JFXPanel javafxPanel = new JFXPanel() {

        @Override
        protected void processMouseWheelEvent(MouseWheelEvent e) {
            final Container parent = getParent();
            final MouseEvent parentEvent = SwingUtilities.convertMouseEvent(this, e, parent);
            parent.dispatchEvent(parentEvent);
        }
    };
    javafxPanel.setBackground(IpnbEditorUtil.getBackground());
    Platform.runLater(() -> {
        final WebView webView = new WebView();
        webView.setContextMenuEnabled(false);
        webView.setOnDragDetected(event -> {
        });
        final WebEngine engine = webView.getEngine();
        initHyperlinkListener(engine);
        final boolean hasMath = source.contains("$");
        if (hasMath) {
            engine.setOnStatusChanged(event -> adjustHeight(webView, javafxPanel, source));
        } else {
            engine.getLoadWorker().stateProperty().addListener((observable, oldValue, newValue) -> {
                if (newValue == Worker.State.SUCCEEDED) {
                    adjustHeight(webView, javafxPanel, source);
                }
            });
        }
        final BorderPane pane = new BorderPane(webView);
        final String prefix;
        if (hasMath) {
            prefix = String.format(ourMathJaxPrefix, width - 500, EditorColorsManager.getInstance().getGlobalScheme().getEditorFontSize());
        } else {
            prefix = String.format(ourPrefix, width - 500);
        }
        final String content = prefix + convertToHtml(source) + ourPostfix;
        engine.loadContent(content);
        final Scene scene = new Scene(pane, 0, 0);
        javafxPanel.setScene(scene);
        updateLaf(LafManager.getInstance().getCurrentLookAndFeel() instanceof DarculaLookAndFeelInfo, engine, javafxPanel);
    });
    return javafxPanel;
}
Also used : JFXPanel(javafx.embed.swing.JFXPanel) BorderPane(javafx.scene.layout.BorderPane) MouseEvent(java.awt.event.MouseEvent) MouseWheelEvent(java.awt.event.MouseWheelEvent) DarculaLookAndFeelInfo(com.intellij.ide.ui.laf.darcula.DarculaLookAndFeelInfo) WebView(javafx.scene.web.WebView) Scene(javafx.scene.Scene) WebEngine(javafx.scene.web.WebEngine)

Example 53 with BorderPane

use of javafx.scene.layout.BorderPane in project mastering-java by Kingminghuang.

the class MultipleBounceBall method start.

@Override
public void start(Stage primaryStage) throws Exception {
    MultipleBallPane ballPane = new MultipleBallPane();
    ballPane.setStyle("-fx-border-color: red");
    Button addBtn = new Button("+");
    Button subtractBtn = new Button("-");
    HBox hBox = new HBox(10);
    hBox.getChildren().addAll(addBtn, subtractBtn);
    hBox.setAlignment(Pos.CENTER);
    addBtn.setOnAction(event -> ballPane.add());
    subtractBtn.setOnAction(event -> ballPane.subtract());
    ballPane.setOnMousePressed(event -> ballPane.pause());
    ballPane.setOnMouseReleased(event -> ballPane.play());
    ScrollBar speedCtrl = new ScrollBar();
    speedCtrl.setMax(50);
    speedCtrl.setValue(25);
    ballPane.rateProperty().bind(speedCtrl.valueProperty());
    BorderPane borderPane = new BorderPane();
    borderPane.setCenter(ballPane);
    borderPane.setTop(speedCtrl);
    borderPane.setBottom(hBox);
    Scene scene = new Scene(borderPane, DEFAULT_WIDTH, DEFAULT_HEIGHT);
    primaryStage.setTitle("Multiple Bounce Ball");
    primaryStage.setScene(scene);
    primaryStage.show();
}
Also used : HBox(javafx.scene.layout.HBox) BorderPane(javafx.scene.layout.BorderPane) Button(javafx.scene.control.Button) Scene(javafx.scene.Scene) ScrollBar(javafx.scene.control.ScrollBar)

Example 54 with BorderPane

use of javafx.scene.layout.BorderPane in project aima-java by aimacode.

the class VacuumEnvironmentViewCtrl method initialize.

@Override
public void initialize(Environment env) {
    if (env instanceof VacuumEnvironment) {
        this.locations = ((VacuumEnvironment) env).getLocations();
        envStateView.getChildren().clear();
        envStateView.getColumnConstraints().clear();
        ColumnConstraints colCons = new ColumnConstraints();
        colCons.setPercentWidth(100.0 / locations.size());
        int i = 0;
        for (String loc : locations) {
            BorderPane pane = new BorderPane();
            pane.setTop(new Label(loc));
            pane.setStyle("-fx-background-color: white");
            envStateView.add(pane, i++, 0);
            envStateView.getColumnConstraints().add(colCons);
        }
    }
    super.initialize(env);
}
Also used : BorderPane(javafx.scene.layout.BorderPane) VacuumEnvironment(aima.core.environment.vacuum.VacuumEnvironment) ColumnConstraints(javafx.scene.layout.ColumnConstraints) Label(javafx.scene.control.Label)

Example 55 with BorderPane

use of javafx.scene.layout.BorderPane in project aima-java by aimacode.

the class NQueensSearchApp method createRootPane.

/**
	 * Defines state view, parameters, and call-back functions and calls the
	 * simulation pane builder to create layout and controller objects.
	 */
@Override
public Pane createRootPane() {
    BorderPane root = new BorderPane();
    StackPane stateView = new StackPane();
    stateViewCtrl = new NQueensViewCtrl(stateView);
    List<Parameter> params = createParameters();
    SimulationPaneBuilder builder = new SimulationPaneBuilder();
    builder.defineParameters(params);
    builder.defineStateView(stateView);
    builder.defineInitMethod(this::initialize);
    builder.defineSimMethod(this::simulate);
    simPaneCtrl = builder.getResultFor(root);
    simPaneCtrl.setParam(SimulationPaneCtrl.PARAM_SIM_SPEED, 1);
    return root;
}
Also used : BorderPane(javafx.scene.layout.BorderPane) SimulationPaneBuilder(aima.gui.fx.framework.SimulationPaneBuilder) NQueensViewCtrl(aima.gui.fx.views.NQueensViewCtrl) Parameter(aima.gui.fx.framework.Parameter) StackPane(javafx.scene.layout.StackPane)

Aggregations

BorderPane (javafx.scene.layout.BorderPane)95 Scene (javafx.scene.Scene)58 Button (javafx.scene.control.Button)19 Label (javafx.scene.control.Label)17 FXMLLoader (javafx.fxml.FXMLLoader)14 Stage (javafx.stage.Stage)14 StackPane (javafx.scene.layout.StackPane)12 IOException (java.io.IOException)11 Parameter (aima.gui.fx.framework.Parameter)10 SimulationPaneBuilder (aima.gui.fx.framework.SimulationPaneBuilder)10 File (java.io.File)10 HBox (javafx.scene.layout.HBox)9 HashMap (java.util.HashMap)8 Insets (javafx.geometry.Insets)8 TextField (javafx.scene.control.TextField)8 Map (java.util.Map)6 MenuItem (javafx.scene.control.MenuItem)6 TableColumn (javafx.scene.control.TableColumn)6 TableView (javafx.scene.control.TableView)6 List (java.util.List)5