import java.awt.*; import java.awt.event.*; import javax.swing.*; class Example3 extends JFrame { public Example3() { Container content_pane = this.getContentPane(); content_pane.setLayout(new FlowLayout()); JButton button = new JButton("Hello world"); JCheckBox checkbox = new JCheckBox("Hello world"); content_pane.add(button); content_pane.add(checkbox); //// sharing a common model across 2 views checkbox.setModel(button.getModel()); setSize(300,300); setVisible(true); } public static void main(String argv[]) { new Example3(); } }