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;
}
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;
}
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();
}
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);
}
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;
}
Aggregations