Choice menu help

R

Raymond Sin

I would like to make the Choice menu to popup on an event. However, I
don't know which method to use to cause the menu to popup. Can someone help
me?
 
?

=?iso-8859-15?Q?Schenaerts_Micha=EBl?=

JPopupMenu jpmPopEvent = new JPopupMenu();
JMenuItem jmiAdd = new JMenuItem("Add");

jmiAdd.addActionListener(......);

jpmPopEvent.add(jmiAdd);

JButton jbPop = new JButton("pop");

jbPop.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
jpmPopEvent.setVisible(true);
}
});
 
R

Raymond Sin

Thank you very much Schenaerts.

I am sorry, but I think my question was not very clear. What I am trying to
ask is to cause the Choice menu to open up, just like when you are clicking
on the unside down triangle.
 
?

=?iso-8859-15?Q?Schenaerts_Micha=EBl?=

unside down ???

If you mean like the office XP's menues, you can try

void mouseEntered(MouseEvent e)
Invoked when the mouse enters a component.

from the MouseAdapter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top