JButton bkButton = new JButton(new ImageIcon("src/Images/smallBArrow.bmp"));
JPanel buttonPanel = new JPanel(new FlowLayout());
buttonPanel.add(bkButton);
使用动作监听器我需要能够单击并执行操作(返回,转发或刷新)
答案 0 :(得分:5)
通常使用匿名内部类...
bkButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
backButtonPressed();
}
});
请参阅this回答