I want to have a Main Stage (Main GUI) that will include a Menu Bar at the top, then consist of either an AnchorPane with a vertical SplitPane[split happens at 350pixels] (which contains another horizontal SplitPane on the right side, giving me a total of 3 sections to work with), or a BorderPane which only utilizes the Left,Top, and Center of the BorderPane. In the vertical SplitPane (or Left BorderPane) I want 3 buttons that take up around 320x320 Pixels, leaving a 15 pixel buffer. The Top section[200 pixel heightxMaxValue width] will have an background image, an ImageView, and a Label. Now the Center section of the BorderPane, or Right side of the 1st SplitPane, which contains a horizontal SplitPane, im referencing the bottom side of that SplitPane, will be the biggest area. I want to have 5 buttons in that area, [I can do the sizing and spacing of those buttons, probably use a GridPane inside the bottom section of the horizontal Splitpane] that will become visible when the first button on the Left side is clicked. And then I want to have another 5 different buttons show up when the second button is clicked, removing the first 5 buttons. I don't know if I need to have the buttons on the left side call the GridPane the 5 buttons are in to be visible, or how to set it up. And then I want the buttons inside the GridPane to call another Stage (5 seperate stages actually, but one at a time visible) that covers the entire first stage while it is open. Also, i need this to size to be default size of 1440x900 (minimum size) that opens Maximized. (I can handle that function, i just need the children nodes to resize with it, but only one size. I need the Left Side of the first split pane to resize only height, and the Top section to resize only width. I know, this is alot, but i tried to give as much information as I could. Thank you everyone for your help with this.
Here is the code is have so far:
javaFX
package scindbmain;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
public class MainGUI extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Parent rootPane = FXMLLoader.load(getClass().getResource("maingui.fxml"));
Scene scene = new Scene(rootPane);
primaryStage.setTitle("Star Citizen InfoNet & Database");
primaryStage.setScene(scene);
primaryStage.setMinWidth(1440);
primaryStage.setMinHeight(900);
primaryStage.setMaximized(true);
primaryStage.setResizable(false);
primaryStage.show();
}
public static void main(String[] args){
launch(args);
}
}
And here is my FXML file to go with it:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="900.0" prefWidth="1440.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<MenuBar maxHeight="25.0" minHeight="25.0" prefHeight="25.0" style="-fx-background-color: beige;" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
<MenuItem mnemonicParsing="false" text="Close" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit">
<items>
<MenuItem mnemonicParsing="false" text="Delete" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" text="About" />
</items>
</Menu>
</menus>
</MenuBar>
<SplitPane dividerPositions="0.18567454798331015" layoutY="29.0" prefHeight="900.0" prefWidth="1440.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="25.0">
<items>
<VBox maxWidth="350.0" minHeight="-Infinity" minWidth="350.0" prefHeight="875.0" prefWidth="350.0" spacing="30.0" style="-fx-background-color: grey;">
<children>
<Button maxHeight="300.0" maxWidth="300.0" minHeight="300.0" minWidth="300.0" mnemonicParsing="false" prefHeight="300.0" prefWidth="300.0" style="-fx-background-color: silver;" text="Star Systems & Locations" textAlignment="CENTER" wrapText="true">
<font>
<Font name="Impact" size="45.0" />
</font>
<VBox.margin>
<Insets />
</VBox.margin>
</Button>
<Button layoutX="25.0" layoutY="25.0" maxHeight="300.0" maxWidth="300.0" minHeight="300.0" minWidth="300.0" mnemonicParsing="false" prefHeight="300.0" prefWidth="300.0" style="-fx-background-color: silver;" text="Starships, Weapons & Components" textAlignment="CENTER" wrapText="true">
<font>
<Font name="Impact" size="45.0" />
</font>
<VBox.margin>
<Insets />
</VBox.margin>
</Button>
<Button layoutX="25.0" layoutY="375.0" maxHeight="300.0" maxWidth="300.0" minHeight="300.0" minWidth="300.0" mnemonicParsing="false" prefHeight="300.0" prefWidth="300.0" style="-fx-background-color: silver;" text="Trading, Mining & Refining" textAlignment="CENTER" wrapText="true">
<font>
<Font name="Impact" size="45.0" />
</font>
<VBox.margin>
<Insets />
</VBox.margin>
</Button>
</children>
<padding>
<Insets bottom="15.0" left="25.0" right="15.0" top="15.0" />
</padding>
</VBox>
<SplitPane dividerPositions="0.22451317296678122" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0">
<items>
<HBox maxHeight="200.0" minHeight="200.0" minWidth="1090.0" prefHeight="200.0" prefWidth="1090.0" spacing="25.0" style="-fx-background-color: black;">
<padding>
<Insets bottom="10.0" left="15.0" top="10.0" />
</padding>
<children>
<ImageView fitHeight="180.0" fitWidth="180.0" pickOnBounds="true" HBox.hgrow="NEVER">
<image>
<Image url="@../SCImages/TaktikalLogo1.jpg" />
</image>
</ImageView>
<Label minWidth="1000.0" prefHeight="180.0" prefWidth="1000.0" style="-fx-border-color: white;" text="STAR CITIZEN INFONET & DATABASE" textAlignment="CENTER" textFill="WHITE" wrapText="true">
<HBox.margin>
<Insets bottom="10.0" top="10.0" />
</HBox.margin>
<font>
<Font name="Mongolian Baiti" size="68.0" />
</font>
</Label>
</children>
</HBox>
<AnchorPane minHeight="668.0" minWidth="1090.0" prefHeight="338.0" prefWidth="1090.0">
<children>
<StackPane prefHeight="668.0" prefWidth="1090.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<GridPane>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
</GridPane>
</children>
</StackPane>
</children></AnchorPane>
</items>
</SplitPane>
</items>
</SplitPane>
</children>
</AnchorPane>
Now, as you can see I have coded some of the GUI. And I have 3 buttons on the left side. I want to have each of those buttons call a Pane(AnchorPane,StackPane, i dont know which one) to fill the bottom right of my Stage (bottom half of the horizontal StackPane) with 5 buttons on each pane. Each button will call a different Pane with 5 different buttons that will each call a different stage. But for now, I have problems with the GUI. I have it set to Maximum because if i set it to 1440x900, and set it to not resize, it will still let me resize it down a little bit, and it moves the GUI out of place. I don't think this code is the correct code to do this with, which is why I was asking for someone's example earlier, instead of putting this code up. Thank you for any help.