Having to resize a JFrame

Hi,I'm relatively new to Java. I have developed a simple GUI using swing, it only really consits of a JMenuBar. However, when executing it displays nothing until it is slightly resized. This happens on my Mac and also when ran on Linux. Any ideas?
[262 byte] By [jucoa] at [2007-11-26 23:43:20]
# 1
Please post the code u've used
chasana at 2007-7-11 15:13:14 > top of Java-index,Java Essentials,New To Java...
# 2

Sure, it's pretty much just a JFrame with a JMenuBar.

public class GUI implements ActionListener {

private JFrame frame;

private JMenuItem exit;

public GUI() {

/* Initialise the JFrame */

frame = new JFrame("JC Chat");

frame.setSize(300,440);

frame.setVisible(true);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setJMenuBar(createMenuBar());

// createComponents();

} /* End constructor */

public JMenuBar createMenuBar() {

/* Create the Frame MenuBar */

JMenuBar menu = new JMenuBar();

JMenu file = new JMenu("File");

JMenu edit = new JMenu("Edit");

exit = new JMenuItem("Exit");

exit.setMnemonic('E');

exit.addActionListener(this);

file.add(exit);

menu.add(file);

menu.add(edit);

return menu;

}

Message was edited by:

juco

jucoa at 2007-7-11 15:13:14 > top of Java-index,Java Essentials,New To Java...
# 3
You want to set the JFrame visible as the LAST thing you do.
TuringPesta at 2007-7-11 15:13:14 > top of Java-index,Java Essentials,New To Java...
# 4
That worked! Thanks a lot
jucoa at 2007-7-11 15:13:14 > top of Java-index,Java Essentials,New To Java...