67,515
社区成员
发帖
与我相关
我的任务
分享
JButton btn1 = new JButton("A");
JButton btn2 = new JButton("B");
ActionListener listener = new ActionListener();
btn1.addActionListener(listener);
btn2.addActionListener(listener);
JMenuItem openAction = new JMenuItem("Open");
openAction.addActionListener(listener);