import javax.swing.*; import java.awt.event.*; public class MyTime { public MyTime () { playIcon = new ImageIcon("images/play-button.jpg"); pauseIcon = new ImageIcon("images/pause.jpg"); playing=false; view = new JButton(playIcon); view.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { // to be coded } }); } public JButton getView () { return view; } private boolean playing; // object model private JButton view; // object view private ImageIcon playIcon, pauseIcon; // used by view }