code_junkie

Best way to separate Business from Presentation Logic?

Nov 13th, 2011
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. public class ExamplePanel extends JPanel implements ActionListener
  2. {
  3. private JButton button;
  4. private ActionListener buttonListener;
  5.  
  6. public ExamplePanel(ActionListener buttonListener)
  7. {
  8. this.button = new JButton("Do Something");
  9. this.buttonListener = buttonListener;
  10. this.button.addListener(this.buttonListener);
  11. }
  12.  
  13. public void actionPerformed(ActionEvent e)
  14. {
  15. this.buttonListener.actionPerformed(e);
  16. }
  17. }
Add Comment
Please, Sign In to add comment