Hi,
I have a JPopupMenu added to a JComboBox in metal L&F and the popup will not show up. If I change the L&F to Windows I get acceptable behavior in that if I click the white part of the combo the popup will show up (if you right click the part with the arrow even in Windows L&F that does not work but I could live with that behaviour). Does anyone have a fix or work around for this - I want to use the metal L&F overall - if I could figure out a way to just use the windows L&F for just the combo that would be fine too but I don't know how to do that or if it is possible. Below is the standard code I am using. And I almost forgot the e.isPopupTrigger does not seem to be ever returning true - so I've done my
testing by commenting out that if (e.isPopupTrigger())
test.
cmbLevelOne.addMouseListener(new MouseAdapter(){
//btnNew.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e){
if (e.isPopupTrigger())
{
createPopup( e, e.getPoint() );
}
}
public void mousePressed(MouseEvent e){
// if (e.isPopupTrigger())
//{
createPopup( e, e.getPoint() );
System.out.println("called");
//}
}
});
public void createPopup(MouseEvent e, Point p)
{
popup = new JPopupMenu();
popup.add(mniNew);
popup.add(mniEdit);
popup.add(mniDelete);
popup.setInvoker (this);
popup.show(e.getComponent(), p.x, p.y);
}
Many Thanks!