use of javax.swing.JToggleButton in project chuidiang-ejemplos by chuidiang.
the class ToggleButtonExample method main.
public static void main(String[] args) {
JFrame frame = new JFrame("JToggleButton Example");
check = new JToggleButton("Push here ");
check2 = new JToggleButton("I'm a mirror");
frame.getContentPane().add(check);
frame.getContentPane().setLayout(new FlowLayout());
frame.getContentPane().add(check2);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
check.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
check2.setSelected(check.isSelected());
}
});
}
Aggregations