Problema del menú emergente de JWindow
importar javax.swing.JComponent;
importar javax.swing.JLabel
importar javax.swing.JPopupMenu; p>importar javax.swing.JWindow;
clase pública JWin {
public static void main( String[] args) {
JWindow w = nueva JWindow ();
w.setAlwaysOnTop(true);
w.setLayout(new FlowLayout(FlowLayout.LEFT));
final JPopupMenu pm = nuevo JPopupMenu ();
pm.add(" a ");
pm.add(" b ");
pm.add(" c ") ;
JButton b = new JButton("salir");
w.add(b);
JLabel l = new JLabel("
ventana emergente
");
l.setOpaque(true);
l.setBackground(Color.red);
w.add(l);
// w.getContentPane().addMouseListener(new MouseListener(){
// public void public void mouseClicked(MouseEvent e) {}
// public void mouseEntered(MouseEvent e) {}
// public void mouseExited(MouseEvent e) {}
// public void mousePressed (MouseEvent e) {if(e.MouseEvent e) {}
// public void mouseEntered(MouseEvent e) {}
// public void mouseExited(MouseEvent e) {}
//isPopupTrigger())pop(e);}
// public void mouseReleased(MouseEvent e) {if(e. isPopupTrigger())pop(e);}
// void pop(MouseEvent e){
// pm.show((JComponent)e.getSource(),e.getX(),e.getY()) ;
// }
// });
l.addMouseListener(new MouseListener(){
public void mouseClicked( MouseEvent e) {}
public void mouseEntered( MouseEvent e) {}
public void mous
eExited(MouseEvent e) {}
public void mousePressed(MouseEvent e) {if(e.isPopupTrigger())pop(e);}