javafx.scene.layout.BorderPane Java Examples

The following examples show how to use javafx.scene.layout.BorderPane. 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: InfoStage.java    From pdfsam with 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 File: ProgressIndicatorTest.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
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 #3
Source File: CSSFXTesterApp.java    From cssfx with 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 #4
Source File: OfflineAdminApp.java    From chvote-1-0 with GNU Affero General Public License v3.0 6 votes vote down vote up
@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 #5
Source File: Measurement.java    From strangefx with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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 #6
Source File: GuiMainPreloader.java    From BlockMap with 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 #7
Source File: JFXFontCalibration.java    From phoebus with 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 #8
Source File: RunDataSetSamples.java    From chart-fx with 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 #9
Source File: ChartViewerSkin.java    From buffer_bci with 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 #10
Source File: ChartViewerSkin.java    From openstock with 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 #11
Source File: MenuControllerApp.java    From tcMenu with 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 #12
Source File: CustomNavigationDrawerSkin.java    From WorkbenchFX with 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 #13
Source File: ChartViewerSkin.java    From ccu-historian with 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 #14
Source File: ConsoleLogStage.java    From xframium-java with GNU General Public License v3.0 6 votes vote down vote up
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 #15
Source File: WebViewContextMenuTest.java    From oim-fx with 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 #16
Source File: CalibratePatchesBase.java    From testing-video with GNU General Public License v3.0 6 votes vote down vote up
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 #17
Source File: AnalyticResultsPane.java    From constellation with 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 #18
Source File: TabSample.java    From marathonv5 with 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 #19
Source File: BaseGraphApp.java    From diirt with 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 #20
Source File: MultipleMainPane.java    From oim-fx with 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 #21
Source File: Main.java    From java_fx_node_link_demo with 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 #22
Source File: VideoView.java    From BotLibre with 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 #23
Source File: AbstractSceneFileEditor.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
/**
 * Apply a new material from an asset tree.
 *
 * @param dragEvent the drag event.
 * @param file      the file.
 */
@FxThread
private void applyMaterial(@NotNull final DragEvent dragEvent, @NotNull final Path file) {

    final Path assetFile = notNull(getAssetFile(file), "Not found asset file for " + file);
    final String assetPath = toAssetPath(assetFile);

    final MA editor3DState = getEditor3DPart();
    final MaterialKey materialKey = new MaterialKey(assetPath);
    final Camera camera = editor3DState.getCamera();

    final BorderPane area = get3DArea();
    final Point2D areaPoint = area.sceneToLocal(dragEvent.getSceneX(), dragEvent.getSceneY());

    EXECUTOR_MANAGER.addJmeTask(() -> {

        final Geometry geometry = editor3DState.getGeometryByScreenPos((float) areaPoint.getX(),
                camera.getHeight() - (float) areaPoint.getY());

        if (geometry == null) return;
        final Object linkNode = findParent(geometry, AssetLinkNode.class::isInstance);
        if (linkNode != null) return;

        final AssetManager assetManager = EditorUtil.getAssetManager();
        final Material material = assetManager.loadAsset(materialKey);

        final PropertyOperation<ChangeConsumer, Geometry, Material> operation =
                new PropertyOperation<>(geometry, Messages.MODEL_PROPERTY_MATERIAL, material, geometry.getMaterial());

        operation.setApplyHandler(Geometry::setMaterial);

        execute(operation);
    });
}
 
Example #24
Source File: MainWindow.java    From PDF4Teachers with Apache License 2.0 5 votes vote down vote up
public MainWindow(){

        root = new BorderPane();
        StyleManager.putStyle(root, Style.DEFAULT);

        Scene scene = new Scene(root, Main.SCREEN_BOUNDS.getWidth()-200 >= 1200 ? 1200 : Main.SCREEN_BOUNDS.getWidth()-200, Main.SCREEN_BOUNDS.getHeight()-200 >= 675 ? 675 : Main.SCREEN_BOUNDS.getHeight()-200);

        setTitle(TR.tr("PDF4Teachers - Aucun document"));
        getIcons().add(new Image(getClass().getResource("/logo.png")+""));

        setMinWidth(700);
        setMinHeight(393);
        setResizable(true);
        setScene(scene);

        new Macro(scene);

        setOnCloseRequest(e -> {
            userData.saveData();
            if(e.getSource().equals(menuBar)) return;
            hasToClose = true;

            if(!mainScreen.closeFile(!Main.settings.isAutoSave())) {
                e.consume(); hasToClose = false; return;
            }
            System.exit(0);
        });

    }
 
Example #25
Source File: PhoebusApplication.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/** @return <code>true</code> if menu is visible */
boolean isMenuVisible()
{
    final BorderPane layout = DockStage.getLayout(main_stage);
    final VBox top = (VBox) layout.getTop();
    return top.getChildren().contains(menuBar);
}
 
Example #26
Source File: Chess.java    From games_oop_javafx with Apache License 2.0 5 votes vote down vote up
private void refresh(final BorderPane border) {
    Group grid = this.buildGrid();
    this.logic.clean();
    border.setCenter(grid);
    this.buildWhiteTeam(grid);
    this.buildBlackTeam(grid);
}
 
Example #27
Source File: RunMathSamples.java    From chart-fx with Apache License 2.0 5 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("DataSetAverageSample", new DataSetAverageSample()));
    buttons.getChildren().add(new MyButton("DataSetFilterSample", new DataSetFilterSample()));
    buttons.getChildren()
            .add(new MyButton("DataSetIntegrateDifferentiateSample", new DataSetIntegrateDifferentiateSample()));
    buttons.getChildren()
            .add(new MyButton("DataSetIntegrationWithLimitsSample", new DataSetIntegrationWithLimitsSample()));
    buttons.getChildren().add(new MyButton("DataSetSpectrumSample", new DataSetSpectrumSample()));
    buttons.getChildren().add(new MyButton("EMDSample", new EMDSample()));
    buttons.getChildren().add(new MyButton("FourierSample", new FourierSample()));
    buttons.getChildren().add(new MyButton("FrequencyFilterSample", new FrequencyFilterSample()));
    buttons.getChildren().add(new MyButton("GaussianFitSample", new GaussianFitSample()));
    // buttons.getChildren().add(new MyButton("IIRFilterSample", new IIRFilterSample()));
    buttons.getChildren().add(new MyButton("IIRFrequencyFilterSample", new IIRFrequencyFilterSample()));
    buttons.getChildren().add(new MyButton("ShortTermFourierTransform", new ShortTimeFourierTransformSample()));
    buttons.getChildren().add(new MyButton("TSpectrum", new TSpectrumSample()));
    buttons.getChildren().add(new MyButton("WaveletDenoising", new WaveletDenoising()));
    buttons.getChildren().add(new MyButton("WaveletScalogram", new WaveletScalogram()));

    final Scene scene = new Scene(root);

    primaryStage.setTitle(this.getClass().getSimpleName());
    primaryStage.setScene(scene);
    primaryStage.setOnCloseRequest(evt -> System.exit(0));
    primaryStage.show();
}
 
Example #28
Source File: TabController.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
private void configureTab(Tab tab, String title, String iconPath, AnchorPane containerPane, URL resourceURL, EventHandler<Event> onSelectionChangedEvent) {
    double imageWidth = 40.0;

    ImageView imageView = new ImageView(new Image(iconPath));
    imageView.setFitHeight(imageWidth);
    imageView.setFitWidth(imageWidth);

    Label label = new Label(title);
    label.setMaxWidth(tabWidth - 20);
    label.setPadding(new Insets(5, 0, 0, 0));
    label.setStyle("-fx-text-fill: black; -fx-font-size: 10pt; -fx-font-weight: bold;");
    label.setTextAlignment(TextAlignment.CENTER);

    BorderPane tabPane = new BorderPane();
    tabPane.setRotate(90.0);
    tabPane.setMaxWidth(tabWidth);
    tabPane.setCenter(imageView);
    tabPane.setBottom(label);

    tab.setText("");
    tab.setGraphic(tabPane);

    tab.setOnSelectionChanged(onSelectionChangedEvent);

    if (containerPane != null && resourceURL != null) {
        try {
            Parent contentView = FXMLLoader.load(resourceURL);
            containerPane.getChildren().add(contentView);
            AnchorPane.setTopAnchor(contentView, 0.0);
            AnchorPane.setBottomAnchor(contentView, 0.0);
            AnchorPane.setRightAnchor(contentView, 0.0);
            AnchorPane.setLeftAnchor(contentView, 0.0);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
 
Example #29
Source File: Main.java    From sis with Apache License 2.0 5 votes vote down vote up
/**
 * Invoked by JavaFX for starting the application.
 * This method is called on the JavaFX Application Thread.
 *
 * @param window  the primary stage onto which the application scene will be be set.
 */
@Override
public void start(final Stage window) {
    this.window = window;
    final Vocabulary vocabulary = Vocabulary.getResources((Locale) null);
    /*
     * Configure the menu bar. For most menu item, the action is to invoke a method
     * of the same name in this application class (e.g. open()).
     */
    final MenuBar menus = new MenuBar();
    final Menu file = new Menu(vocabulary.getString(Vocabulary.Keys.File));
    {
        final MenuItem open = new MenuItem(vocabulary.getMenuLabel(Vocabulary.Keys.Open));
        open.setAccelerator(KeyCombination.keyCombination("Shortcut+O"));
        open.setOnAction(e -> open());

        final MenuItem exit = new MenuItem(vocabulary.getString(Vocabulary.Keys.Exit));
        exit.setOnAction(e -> Platform.exit());
        file.getItems().addAll(open, new SeparatorMenuItem(), exit);
    }
    menus.getMenus().add(file);
    /*
     * Set the main content and show.
     */
    content = new ResourceView();
    final BorderPane pane = new BorderPane();
    pane.setTop(menus);
    pane.setCenter(content.pane);
    Scene scene = new Scene(pane);
    window.setTitle("Apache Spatial Information System");
    window.setScene(scene);
    window.setWidth(800);
    window.setHeight(650);
    window.show();
}
 
Example #30
Source File: InputDialog.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Create our input dialog.
 */
private InputDialog() {
    initModality(Modality.APPLICATION_MODAL);
    setResizable(false);
    BorderPane mainPane = new BorderPane();
    messageLabel = new Label();
    BorderPane.setMargin(messageLabel, new Insets(5));
    mainPane.setTop(messageLabel);
    textField = new TextField();
    BorderPane.setMargin(textField, new Insets(5));
    mainPane.setCenter(textField);
    okButton = new Button(LabelGrabber.INSTANCE.getLabel("ok.button"), new ImageView(new Image("file:icons/tick.png")));
    okButton.setDefaultButton(true);
    okButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent t) {
            hide();
        }
    });
    BorderPane.setMargin(okButton, new Insets(5));
    BorderPane.setAlignment(okButton, Pos.CENTER);
    mainPane.setBottom(okButton);
    Scene scene = new Scene(mainPane);
    if (QueleaProperties.get().getUseDarkTheme()) {
        scene.getStylesheets().add("org/modena_dark.css");
    }
    setScene(scene);
}