Java Code Examples for javafx.scene.layout.BorderPane

The following examples show how to use javafx.scene.layout.BorderPane. These examples are extracted from open source projects. 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 Project: pdfsam   Source File: InfoStage.java    License: GNU Affero General Public License v3.0 7 votes vote down vote up
@Inject
public InfoStage(InfoPane infoPane, List<Image> logos, StylesConfig styles) {
    BorderPane containerPane = new BorderPane();
    containerPane.getStyleClass().addAll(Style.CONTAINER.css());
    containerPane.setCenter(infoPane);
    containerPane.setBottom(new ClosePane());
    Scene scene = new Scene(containerPane);
    scene.getStylesheets().addAll(styles.styles());
    scene.setOnKeyReleased(new HideOnEscapeHandler(this));
    setScene(scene);
    setTitle(DefaultI18nContext.getInstance().i18n("Document details"));
    getIcons().addAll(logos);
    setMaximized(true);
}
 
Example 2
Source Project: BotLibre   Source File: VideoView.java    License: Eclipse Public License 1.0 6 votes vote down vote up
public void setVideoView() {
	Platform.runLater(new Runnable() {

		@Override
		public void run() {

			final DoubleProperty width = mediaView.fitWidthProperty();
			final DoubleProperty height = mediaView.fitHeightProperty();
			width.bind(Bindings.selectDouble(mediaView.sceneProperty(), "width"));
			height.bind(Bindings.selectDouble(mediaView.sceneProperty(), "height"));
			BorderPane borderPane = new BorderPane();
			borderPane.setCenter(mediaView);
			final Scene scene = new Scene(borderPane, Color.WHITE);
			((JFXPanel) VideoView.jfx).setScene(scene);

		}
	});
	this.component = jfx;
}
 
Example 3
Source Project: marathonv5   Source File: TabSample.java    License: Apache License 2.0 6 votes vote down vote up
public TabSample() {
    BorderPane borderPane = new BorderPane();
    final TabPane tabPane = new TabPane();
    tabPane.setPrefSize(400, 400);
    tabPane.setSide(Side.TOP);
    tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
    final Tab tab1 = new Tab();
    tab1.setText("Tab 1");
    final Tab tab2 = new Tab();
    tab2.setText("Tab 2");
    final Tab tab3 = new Tab();
    tab3.setText("Tab 3");
    final Tab tab4 = new Tab();
    tab4.setText("Tab 4");
    tabPane.getTabs().addAll(tab1, tab2, tab3, tab4);
    borderPane.setCenter(tabPane);
    getChildren().add(borderPane);
}
 
Example 4
Source Project: constellation   Source File: AnalyticResultsPane.java    License: Apache License 2.0 6 votes vote down vote up
public AnalyticResultsPane(final AnalyticController analyticController) {

        // the analytic controller
        this.analyticController = analyticController;

        // the progress indicator pane
        this.progressIndicatorPane = new BorderPane();
        Platform.runLater(() -> {
            final ProgressIndicator progressIndicator = new ProgressIndicator();
            progressIndicator.setMaxSize(50, 50);
            progressIndicatorPane.setCenter(progressIndicator);
        });

        // the internal visualisation pane
        this.internalVisualisationPane = new TabPane();
        internalVisualisationPane.prefWidthProperty().bind(this.widthProperty());

        // the graph visualisation pane
        this.graphVisualisationPane = new ToolBar();
        graphVisualisationPane.prefWidthProperty().bind(this.widthProperty());

        // populate the analytic results pane
        this.getChildren().addAll(internalVisualisationPane, graphVisualisationPane);
    }
 
Example 5
Source Project: WorkbenchFX   Source File: CustomNavigationDrawerSkin.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Initializes all parts of the skin.
 */
private void initializeParts() {
  drawerBox = new VBox();
  drawerBox.getStyleClass().add("drawer-box");

  header = new BorderPane();
  header.getStyleClass().add("header");

  menuContainer = new VBox();
  menuContainer.getStyleClass().add("menu-container");

  scrollPane = new PrettyScrollPane(menuContainer);

  backIconShape = new StackPane();
  backIconShape.getStyleClass().add("shape");
  backBtn = new Button("", backIconShape);
  backBtn.getStyleClass().add("icon");
  backBtn.setId("back-button");

  companyLogo = new Label();
  companyLogo.getStyleClass().add("logo");
}
 
Example 6
Source Project: tcMenu   Source File: MenuControllerApp.java    License: Apache License 2.0 6 votes vote down vote up
private RemoteMenuController showConfigChooser(MenuTree tree) throws Exception {
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/remoteSelector.fxml"));
    BorderPane pane = loader.load();
    RemoteSelectorController controller = loader.getController();
    controller.init(tree);

    Stage dialogStage = new Stage();
    dialogStage.getIcons().add(new Image(getClass().getResourceAsStream("/controller-icon.png")));
    dialogStage.setTitle("Connect to tcMenu device");
    dialogStage.initModality(Modality.WINDOW_MODAL);
    dialogStage.initOwner(null);
    Scene scene = new Scene(pane);
    dialogStage.setScene(scene);
    dialogStage.showAndWait();
    return controller.getResult();
}
 
Example 7
Source Project: openstock   Source File: ChartViewerSkin.java    License: GNU General Public License v3.0 6 votes vote down vote up
/** 
 * Creates the node representing this control.
 * 
 * @return The node.
 */
private BorderPane createNode(ChartViewer control) {
    BorderPane borderPane = new BorderPane();
    borderPane.setPrefSize(800, 500);
    StackPane sp = new StackPane();
    sp.setMinSize(10, 10);
    sp.setPrefSize(600, 400);
    this.canvas = new ChartCanvas(getSkinnable().getChart());
    this.canvas.setTooltipEnabled(control.isTooltipEnabled());
    this.canvas.addChartMouseListener(control);
    this.canvas.widthProperty().bind(sp.widthProperty());
    this.canvas.heightProperty().bind(sp.heightProperty());
 
    this.canvas.addMouseHandler(new ZoomHandlerFX("zoom", control));
    sp.getChildren().add(this.canvas);
    
    borderPane.setCenter(sp);
    return borderPane;
}
 
Example 8
Source Project: buffer_bci   Source File: ChartViewerSkin.java    License: GNU General Public License v3.0 6 votes vote down vote up
/** 
 * Creates the node representing this control.
 * 
 * @return The node.
 */
private BorderPane createNode(ChartViewer control) {
    BorderPane borderPane = new BorderPane();
    borderPane.setPrefSize(800, 500);
    StackPane sp = new StackPane();
    sp.setMinSize(10, 10);
    sp.setPrefSize(600, 400);
    this.canvas = new ChartCanvas(getSkinnable().getChart());
    this.canvas.setTooltipEnabled(control.isTooltipEnabled());
    this.canvas.addChartMouseListener(control);
    this.canvas.widthProperty().bind(sp.widthProperty());
    this.canvas.heightProperty().bind(sp.heightProperty());
 
    this.canvas.addMouseHandler(new ZoomHandlerFX("zoom", control));
    sp.getChildren().add(this.canvas);
    
    borderPane.setCenter(sp);
    return borderPane;
}
 
Example 9
private void initUI() {

        BorderPane progressBase = new BorderPane();
        progressBase.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
        progressBase.setBottom(progress);
        progress.setPrefHeight(0);
        progress.getStyleClass().add("progress");

        label.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);

        StackPane stack = new StackPane(progressBase, label);
        stack.prefWidthProperty().bind(widthProperty());
        stack.prefHeightProperty().bind(heightProperty());

        getChildren().add(stack);

        prefWidthProperty().bind(heightProperty());
    }
 
Example 10
protected Parent overlay(Args args) {
    Color fill = getTextFill(args);

    TextFlow topLeft = text(fill, getTopLeftText(args), LEFT);
    TextFlow topCenter = text(fill, getTopCenterText(args), CENTER);
    TextFlow topRight = text(fill, getTopRightText(args), RIGHT);
    TextFlow bottomLeft = text(fill, getBottomLeftText(args), LEFT);
    TextFlow bottomCenter = text(fill, getBottomCenterText(args), CENTER);
    TextFlow bottomRight = text(fill, getBottomRightText(args), RIGHT);

    StackPane top = new StackPane(topLeft, topCenter, topRight);
    StackPane bottom = new StackPane(bottomLeft, bottomCenter, bottomRight);

    BorderPane.setMargin(top, new Insets(20));
    BorderPane.setMargin(bottom, new Insets(20));

    BorderPane layout = new BorderPane();
    layout.setBackground(EMPTY);
    layout.setTop(top);
    layout.setBottom(bottom);

    return layout;
}
 
Example 11
private Parent createRoot() {
	StackPane stackPane = new StackPane();

	BorderPane controlsPane = new BorderPane();
	controlsPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
	stackPane.getChildren().add(controlsPane);
	controlsPane.setCenter(new TableView<Void>());

	ProgressIndicator indicator = new ProgressIndicator();
	indicator.setMaxSize(120, 120);
	stackPane.getChildren().add(indicator);
	StackPane.setAlignment(indicator, Pos.BOTTOM_RIGHT);
	StackPane.setMargin(indicator, new Insets(20));

	return stackPane;
}
 
Example 12
Source Project: java_fx_node_link_demo   Source File: Main.java    License: The Unlicense 6 votes vote down vote up
@Override
public void start(Stage primaryStage) {
	BorderPane root = new BorderPane();
	
	try {
		
		Scene scene = new Scene(root,640,480);
		scene.getStylesheets().add(getClass().getResource("/application.css").toExternalForm());
		primaryStage.setScene(scene);
		primaryStage.show();
		
	} catch(Exception e) {
		e.printStackTrace();
	}
	
	root.setCenter(new RootLayout());
}
 
Example 13
Source Project: chart-fx   Source File: RunDataSetSamples.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void start(final Stage primaryStage) {
    final BorderPane root = new BorderPane();

    final FlowPane buttons = new FlowPane();
    buttons.setAlignment(Pos.CENTER_LEFT);
    root.setCenter(buttons);
    root.setBottom(makeScreenShot);

    buttons.getChildren().add(new MyButton("DataSetToByteArraySample", () -> DataSetToByteArraySample.main(null)));

    final Scene scene = new Scene(root);

    primaryStage.setTitle(this.getClass().getSimpleName());
    primaryStage.setScene(scene);
    primaryStage.setOnCloseRequest(evt -> Platform.exit());
    primaryStage.show();
}
 
Example 14
@Override
public void start(Stage primaryStage) throws Exception {
    PropertyConfigurator.configure(getLog4jProperties());
    ResourceBundle resourceBundle = getBundle();

    initializeDefaultExceptionHandler(resourceBundle);

    primaryStage.setTitle(resourceBundle.getString("primaryStage.title"));
    primaryStage.getIcons().add(new Image(OfflineAdminApp.class.getResourceAsStream("images/icon.gif")));

    BorderPane rootLayout = initRootLayout(resourceBundle);
    Scene mainScene = new Scene(rootLayout);
    mainScene.getStylesheets().add(getStyleSheet().toExternalForm());

    primaryStage.setScene(mainScene);
    primaryStage.show();
}
 
Example 15
Source Project: cssfx   Source File: CSSFXTesterApp.java    License: Apache License 2.0 6 votes vote down vote up
public Parent buildUI() {
    BorderPane bp = new BorderPane();

    int prefWidth = 300;
    int prefHeight = 200;

    Button btnShowBottomBar = new Button("Dynamic bottom bar");
    btnShowBottomBar.setId("dynamicBar");
    btnShowBottomBar.setOnAction((ae) -> bp.setBottom(createButtonBar()));
    btnLoadOddCSS = new Button("Load additional CSS");
    btnLoadOddCSS.setId("dynamicCSS");
    Button btnCreateStage = new Button("Create new stage");
    btnCreateStage.setOnAction(ae -> {
        Stage stage = new Stage();
        fillStage(stage);
        stage.show();
    });
    btnCreateStage.setId("dynamicStage");
    FlowPane topBar = new FlowPane(btnShowBottomBar, btnLoadOddCSS, btnCreateStage);

    topBar.getStyleClass().addAll("button-bar", "top");

    bp.setTop(topBar);
    bp.setCenter(buildCirclePane(prefWidth, prefHeight));
    return bp;
}
 
Example 16
Source Project: BlockMap   Source File: GuiMainPreloader.java    License: MIT License 6 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
	splashScreen = stage;
	stage.centerOnScreen();
	stage.initStyle(StageStyle.TRANSPARENT);
	stage.getIcons().add(new Image(getClass().getResourceAsStream("icon.png")));
	ImageView icon = new ImageView(getClass().getResource("icon.png").toString());
	icon.setFitWidth(SPLASH_WIDTH);
	icon.setPreserveRatio(true);
	BorderPane parent = new BorderPane(icon);
	parent.setBackground(Background.EMPTY);
	Scene scene = new Scene(parent, SPLASH_WIDTH, SPLASH_HEIGHT);
	scene.setFill(Color.TRANSPARENT);

	splashScreen.setScene(scene);
	splashScreen.show();
}
 
Example 17
Source Project: phoebus   Source File: JFXFontCalibration.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void start(final Stage stage) throws Exception
{
    Logger.getLogger("").setLevel(Level.FINE);
    for (Handler handler : Logger.getLogger("").getHandlers())
        handler.setLevel(Level.FINE);

    final double factor = getCalibrationFactor();

    final BorderPane root = new BorderPane(text);
    final Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Java FX: Calibration factor " + factor);

    if (Math.abs(factor - 1.0) > 0.01)
       System.err.println("Calibration is not 1.0 but " + factor);

    stage.show();
}
 
Example 18
/** 
 * Creates the node representing this control.
 * 
 * @return The node.
 */
private BorderPane createNode(ChartViewer control) {
    BorderPane borderPane = new BorderPane();
    borderPane.setPrefSize(800, 500);
    StackPane sp = new StackPane();
    sp.setMinSize(10, 10);
    sp.setPrefSize(600, 400);
    this.canvas = new ChartCanvas(getSkinnable().getChart());
    this.canvas.setTooltipEnabled(control.isTooltipEnabled());
    this.canvas.addChartMouseListener(control);
    this.canvas.widthProperty().bind(sp.widthProperty());
    this.canvas.heightProperty().bind(sp.heightProperty());
 
    this.canvas.addMouseHandler(new ZoomHandlerFX("zoom", control));
    sp.getChildren().add(this.canvas);
    
    borderPane.setCenter(sp);
    return borderPane;
}
 
Example 19
public ConsoleLogStage (Screen screen)
{
  setTitle ("Console Logs");

  setOnCloseRequest (e -> closeWindow ());
  btnHide.setOnAction (e -> closeWindow ());

  BorderPane borderPane = new BorderPane ();
  borderPane.setTop (menuBar);
  borderPane.setCenter (tabPane);

  consoleTab.setClosable (false);

  menuBar.setUseSystemMenuBar (SYSTEM_MENUBAR);
  tabPane.getTabs ().addAll (consoleTab, consoleMessageTab);
  tabPane.setTabMinWidth (80);

  Scene scene = new Scene (borderPane, 800, 500);             // width/height
  setScene (scene);

  windowSaver = new WindowSaver (prefs, this, "DatasetStage");
  windowSaver.restoreWindow ();

  tabPane.getSelectionModel ().select (consoleTab);
}
 
Example 20
Source Project: oim-fx   Source File: WebViewContextMenuTest.java    License: MIT License 6 votes vote down vote up
@Override
public void start(Stage primaryStage) {
	TextField locationField = new TextField(START_URL);

	webView.getEngine().load(START_URL);

	webView.setContextMenuEnabled(false);
	createContextMenu(webView);

	locationField.setOnAction(e -> {
		webView.getEngine().load(getUrl(locationField.getText()));
	});
	BorderPane root = new BorderPane(webView, locationField, null, null, null);
	primaryStage.setScene(new Scene(root, 800, 600));
	primaryStage.show();

}
 
Example 21
Source Project: diirt   Source File: BaseGraphApp.java    License: MIT License 6 votes vote down vote up
@Override
public void start( Stage stage ) throws Exception {
    this.pnlGraph = getGraphView();
    this.pnlError = new MessagePanel( pnlGraph.lastExceptionProperty() );

    BorderPane mainPanel = new BorderPane();
        mainPanel.setTop( this.pnlData );
        mainPanel.setCenter( this.pnlGraph );
        mainPanel.setBottom( this.pnlError );

    //allow components to shrink
    this.pnlData.setMinSize( 0 , 0 );
    this.pnlGraph.setMinSize( 0 , 0 );
    this.pnlError.setMinSize( 0 , 0 );



    Scene scene = new Scene( mainPanel );
    stage.setTitle( "diirt - BaseGraphApp" );
    stage.setScene( scene );
    stage.setWidth( 500 );
    stage.setHeight( 500 );
    stage.show();
}
 
Example 22
Source Project: oim-fx   Source File: MultipleMainPane.java    License: MIT License 6 votes vote down vote up
private void initComponent() {

		multipleListPane.setPrefWidth(228);
		multipleListPane.setPrefHeight(600);
		
		VBox lineVBox = new VBox();
		lineVBox.setMinWidth(1);
		lineVBox.setStyle("-fx-background-color:#000000;");

		BorderPane lineBorderPane = new BorderPane();
		lineBorderPane.setLeft(multipleListPane);
		lineBorderPane.setRight(lineVBox);

		rootBorderPane.setLeft(lineBorderPane);

		this.getChildren().add(rootBorderPane);
	}
 
Example 23
Source Project: classpy   Source File: AboutDialog.java    License: MIT License 5 votes vote down vote up
public static void showDialog() {
    Stage stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    
    BorderPane aboutPane = createAboutPane(stage);
    Scene scene = new Scene(aboutPane, 300, 180);
    
    stage.setScene(scene);
    stage.setTitle("About");
    stage.show();
}
 
Example 24
Source Project: constellation   Source File: ImportTableColumn.java    License: Apache License 2.0 5 votes vote down vote up
public ColumnHeader(String label) {
    setPadding(new Insets(2));
    this.label = new Label(label);
    BorderPane.setAlignment(this.label, Pos.CENTER);
    setTop(this.label);
    setCenter(new Label());
}
 
Example 25
@Override
public void run() {

	this.rootLayout = new BorderPane();

	this.initializeTopLayout();

	this.initializeCenterLayout();

	this.initializeBottomLayout();

	this.initializePluginTabs();

	Scene scene = new Scene(this.rootLayout, 800, 300);
	this.stage = new Stage();

	this.stage.setScene(scene);
	this.stage.setTitle(this.title);
	this.stage.setMaximized(true);
	this.stage.show();
	this.stage.setOnCloseRequest(e -> {
		this.mainPlugin.stop();
		this.visualizationPlugins.forEach(IGUIPlugin::stop);
		this.algorithmEventHistoryPuller.interrupt();
		Platform.runLater(Platform::exit);
	});

	this.algorithmEventHistoryPuller.start();
}
 
Example 26
private BorderPane buildCell() {
	final BorderPane pane = new BorderPane();
	box = new Label();
	box.setAlignment(Pos.TOP_LEFT);

	pane.setLeft(box);
	createAndAddActions(pane);
	// setGraphic(pane);
	createToolTip();
	return pane;
}
 
Example 27
Source Project: Intro-to-Java-Programming   Source File: Exercise_18_36.java    License: MIT License 5 votes vote down vote up
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
	SierpinskiTrianglePane trianglePane = new SierpinskiTrianglePane();
	TextField tfOrder = new TextField();
	tfOrder.setOnAction(
		e -> trianglePane.setOrder(Integer.parseInt(tfOrder.getText())));
	tfOrder.setPrefColumnCount(4);
	tfOrder.setAlignment(Pos.BOTTOM_RIGHT);

	// Pane to hold label, text field, and a button
	HBox hBox = new HBox(10);
	hBox.getChildren().addAll(new Label("Enter an order: "), tfOrder);
	hBox.setAlignment(Pos.CENTER);

	BorderPane borderPane = new BorderPane();
	borderPane.setCenter(trianglePane);
	borderPane.setBottom(hBox);

	// Create a scene and place it in the stage
	Scene scene = new Scene(borderPane, 200, 210);
	primaryStage.setTitle("Exercise_18_36"); // Set the stage title
	primaryStage.setScene(scene); // Place the scene in the stage
	primaryStage.show(); // Display the stage

	scene.widthProperty().addListener(ov -> trianglePane.paint());
	scene.heightProperty().addListener(ov -> trianglePane.paint());
}
 
Example 28
/**
 * Create the translation choice dialog.
 */
public TranslationChoiceDialog() {
    initModality(Modality.APPLICATION_MODAL);
    setTitle(LabelGrabber.INSTANCE.getLabel("translation.choice.title"));
    Utils.addIconsToStage(this);
    BorderPane root = new BorderPane();
    content = new VBox(5);
    BorderPane.setMargin(content, new Insets(10));
    root.setCenter(content);

    Label selectTranslationLabel = new Label(LabelGrabber.INSTANCE.getLabel("select.translation.label"));
    selectTranslationLabel.setWrapText(true);
    content.getChildren().add(selectTranslationLabel);

    Button okButton = new Button(LabelGrabber.INSTANCE.getLabel("close.button"));
    okButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent t) {
            hide();
        }
    });
    okButton.setDefaultButton(true);
    StackPane.setMargin(okButton, new Insets(5));
    StackPane buttonPane = new StackPane();
    buttonPane.setAlignment(Pos.CENTER);
    buttonPane.getChildren().add(okButton);
    root.setBottom(buttonPane);

    Scene scene = new Scene(root);
    if (QueleaProperties.get().getUseDarkTheme()) {
        scene.getStylesheets().add("org/modena_dark.css");
    }
    setScene(scene);
}
 
Example 29
Source Project: marathonv5   Source File: SimpleWebServer.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.setTitle("Simple Web Server");
    BorderPane root = new BorderPane();
    TextArea area = new TextArea();
    root.setCenter(area);
    ToolBar bar = new ToolBar();
    Button openInBrowser = FXUIUtils.createButton("open-in-browser", "Open in External Browser", true);
    openInBrowser.setOnAction((event) -> {
        try {
            Desktop.getDesktop().browse(URI.create(webRoot));
        } catch (IOException e) {
            e.printStackTrace();
        }
    });
    Button changeRoot = FXUIUtils.createButton("fldr_closed", "Change Web Root", true);
    changeRoot.setOnAction((event) -> {
        DirectoryChooser chooser = new DirectoryChooser();
        File showDialog = chooser.showDialog(primaryStage);
        if (showDialog != null)
            server.setRoot(showDialog);
    });
    bar.getItems().add(openInBrowser);
    bar.getItems().add(changeRoot);
    root.setTop(bar);
    System.setOut(new PrintStream(new Console(area)));
    System.setErr(new PrintStream(new Console(area)));
    area.setEditable(false);
    primaryStage.setScene(new Scene(root));
    primaryStage.setOnShown((e) -> startServer(getParameters().getRaw()));
    primaryStage.show();
}
 
Example 30
@Override
public void start(final Stage aStage) throws Exception {
	super.start(aStage);
	final Parent root = FXMLLoader.load(LaTeXDraw.class.getResource("/fxml/Undo.fxml"), injector.getInstance(ResourceBundle.class),
		injector.getInstance(BuilderFactory.class), cl -> injector.getInstance(cl));
	final BorderPane pane = new BorderPane();
	pane.setTop(root);
	pane.setCenter(stage.getScene().getRoot());
	stage.getScene().setRoot(pane);
}