My code consists of two classes one the MainGUI.java and the Screen.java I intend to make different classes for Different Screens and render them when needed
This is the current code i have for MainGUI.java
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
public class MainGUI extends Application{
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage pStage) throws Exception {
Screen firstScreen = new Screen();
Scene mainScene = new Scene(firstScreen );
pStage.setScene(mainScene);
pStage.setTitle("TestProg");
pStage.show();
}
}
This is the code for Screen.java
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
public class Screen extends VBox{
private final Label L1 = new Label("Label 1");
private final Label L2 = new Label("Label 2");
private final TextField F1 = new TextField();
private final TextField F2 = new TextField();
private final Button B1 = new Button("This is a button");
Screen(){
super();
showStuff();
}
private void showStuff(){
this.setSpacing(5);
this.setAlignment(Pos.CENTER);
this.setPadding(new Insets(10,0,0,10));
HBox Box1 = new HBox(L1,F1);
HBox Box2 = new HBox(L2,F2);
this.getChildren().addAll(Box1,Box2,B1);
}
}
This are the screenshots of the GUI i get after running the code:
I have no idea what information would be of help but but I'm using jre1.8.0_25
As you can see from the images the Forms do no show the text properly and also there is a gray rectangle below.