Try removing the line throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
from you actionPerformed
method...and replace it with your required application logic
ActionListener ordermethod = new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(null, "Hello");
}
};
JPopupMenu popup = new JPopupMenu();
JMenuItem arr = new JMenuItem("first");
arr.addActionListener(ordermethod);
popup.add(arr);
arr = new JMenuItem("second");
arr.addActionListener(ordermethod);
popup.add(arr);
myPanel.add(new JLabel("Pattern ordering method:"), gbc);
myPanel.add(arr, gbc);