我的代码:
class PanelGlowny extends JPanel implements ActionListener{}
public class Formatka extends JFrame implements ActionListener{
private JMenuItem klienciMenuItem = new JMenuItem("Klienci");
private JPopupMenu menuPopup = new JPopupMenu();
private PanelGlowny panelGlowny = new PanelGlowny();
public Formatka() {
add(panelGlowny, BorderLayout.CENTER);
menuPopup.add(klienciMenuItem);
panelGlowny.setComponentPopupMenu(menuPopup);
}
}
当我点击鼠标右键时,弹出菜单没有显示,为什么呢?