creationx Posted September 28, 2016 Share Posted September 28, 2016 private void createGUI(){ gui = new JFrame("GUI"); gui.setBounds(100, 100, 136, 227); gui.setVisible(true); gui.setResizable(false); JPanel panel = new JPanel(); gui.add(panel); panel.setBorder(new EmptyBorder(5, 5, 5, 5)); JLabel lblRockCrabs = new JLabel("ROCK CRABS"); lblRockCrabs.setFont(new Font("Arial", Font.BOLD, 14)); lblRockCrabs.setBounds(10, 11, 100, 14); panel.add(lblRockCrabs); JLabel lblFood = new JLabel("Food"); lblFood.setBounds(45, 94, 30, 14); panel.add(lblFood); JComboBox<String> comboBox_1 = new JComboBox<String>(); comboBox_1.setBounds(10, 112, 95, 20); comboBox_1.addItem("SELECT ONE"); comboBox_1.addItem("Lobster"); comboBox_1.addItem("Swordfish"); comboBox_1.addItem("Shark"); comboBox_1.addItem("Lobster"); comboBox_1.addActionListener(e -> foodSelected = comboBox_1.getSelectedItem().toString()); panel.add(comboBox_1); JLabel lblVersion = new JLabel("version 1.0"); lblVersion.setBounds(20, 22, 54, 14); panel.add(lblVersion); JButton btnStartScript = new JButton("START"); btnStartScript.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { started = true; gui.setVisible(false); } }); btnStartScript.setBounds(24, 154, 71, 23); panel.add(btnStartScript); } For some reason the GUI is not showing up fully. It pops up with nothing on it, and I have to hover my mouse over it to suddenly make everything show up. Then it acts normally and I can select my options and move on. What is happening? I followed two tutorials the best I could, but there is clearly something I missed, as other scripts have no problem. Quote Link to comment Share on other sites More sharing options...
Manner Posted September 28, 2016 Share Posted September 28, 2016 Move setVisible(true) to the last line. Quote Link to comment Share on other sites More sharing options...
Precise Posted September 28, 2016 Share Posted September 28, 2016 Add the jpanelto the jframe after you've added all the components to it. Quote Link to comment Share on other sites More sharing options...
creationx Posted September 28, 2016 Author Share Posted September 28, 2016 Move setVisible(true) to the last line. Thanks, this fixed it! Quote Link to comment Share on other sites More sharing options...