First time using Swing to create a GUI and unsure why I am only getting a grey 1280 x 720 window when running the code and nothing else.
There are no error messages. If anyone could assist it would be very helpful.
public void createGUI(){
window = new JFrame();
window.setSize(1280, 720);
window.setTitle("Prototype");
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.getContentPane().setBackground(Color.GRAY);
window.setLayout(null);
window.setVisible(true);
loginScreen = new JPanel();
loginScreen.setBackground(Color.GRAY);
loginScreen.setForeground(Color.WHITE);
userLabel = new JLabel("Username:");
userLabel.setBounds(10, 20, 80, 25);
loginScreen.add(userLabel);
userText = new JTextField(20);
userText.setBounds(100, 20, 165, 25);
loginScreen.add(userText);
passLabel = new JLabel("Password");
passLabel.setBounds(10, 50, 80, 25);
loginScreen.add(passLabel);
passwordText = new JPasswordField();
passwordText.setBounds(100, 50, 165, 25);
loginScreen.add(passwordText);
correctLogin = new JLabel("");
correctLogin.setBounds(10, 110, 300, 25);
loginScreen.add(correctLogin);
logInButton = new JButton("Login");
logInButton.setBounds(10, 80, 80, 25);
loginScreen.add(logInButton);
window.add(loginScreen);
loginScreen.setVisible(true);
}