JPopupMenu is not displayed on right click
问题 import java.awt.FlowLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JFrame; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; public class B extends MouseAdapter { JFrame frame = new JFrame(); JPopupMenu popup = new JPopupMenu(); JMenuItem item1 = new JMenuItem("ADD"); JMenuItem item2 = new JMenuItem("DELETE"); public static void main(String arg[]) { new B(); } B() { frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setLayout(new