Swing Menu dimensions
- by ikurtz
Greetings. I am trying to learn Java and Swing (today is my first day).
I have been able to set up a menu in my test application. but the items occupy very little space (they are narrow). How do I go about extendng the amount of space it uses?
I am studying Teach Yourself Java 6 in 21 Days 5th Ed, Java Swing, 2nd Edition, 2002 and Teach Yourself Programming With Java In 24 Hours, 4th Edition (2005) but none of them shed any light on this issue.
EDIT:
Menu code:
JMenu _Game = new JMenu("Game");
JMenuItem _New = new JMenuItem("New");
JMenuItem _Exit = new JMenuItem("Exit");
JMenu _Turn = new JMenu("Turn");
JMenuItem _Red = new JMenuItem("Red");
JMenuItem _Yellow = new JMenuItem("Yellow");
_Turn.add(_Red);
_Turn.add(_Yellow);
_Game.add(_New);
_Game.addSeparator();
_Game.add(_Turn);
_Game.addSeparator();
_Game.add(_Exit);
JMenu _Help = new JMenu("Help");
JMenuItem _About = new JMenuItem("About");
_Help.add(_About);
JMenuBar _MenuBar = new JMenuBar();
_MenuBar.add(_Game);
_MenuBar.add(_Help);
setJMenuBar(_MenuBar);
EDIT: Solved!
JMenuItem _New = new JMenuItem("New ");
just add spaces as needed! simple.