Posted: Sat Apr 16, 2011 11:21 pm Post subject: JMenu Bar
For our year end project we have to make a search Database program and my user interface has a JMenu at the top and i was wonder if there is a way to make the top button- do an action.
What i mean is if the menu looked like the below example i want is so that if you push the original instructions the instruction pane would be created right away but right now i can only do that from the drop down thing from instructions... Like you click it and then you have to click it again below which just seems useless and stupid.
Anyway If anyone could help me with the command i need for action performed to make this work it would be great.
Posted: Mon Apr 25, 2011 9:12 pm Post subject: Re: JMenu Bar
The JMenu Bar
code:
JFrame f = new JFrame("Frame");
JMenuBar menuBar = new JMenuBar();
f.setJMenuBar(menuBar);
JMenu menu = new JMenu("Menu");
menuBanr.add(menu);
JMenuItem item = new JMenuItem("Click Me");
menu.add(item);
item.addActionListener(this); //Your class must implement ActionListener
f.setVisible(true);