Java examples for Swing:Action
add Action Listener to JButton via Java Bean EventHandler
//package com.java2s; import java.awt.event.ActionListener; import java.beans.EventHandler; import javax.swing.JButton; public class Main { public static void addActionListener(JButton btn, Object target, String method) {/* w w w. j av a 2 s . co m*/ btn.addActionListener((ActionListener) EventHandler.create( ActionListener.class, target, method)); } }