You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Button.java 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
  3. Use and copying of this software and preparation of derivative works based
  4. upon this software are permitted. Any distribution of this software or
  5. derivative works must comply with all applicable United States export control
  6. laws.
  7. This software is made available AS IS, and Xerox Corporation makes no warranty
  8. about the software, its performance or its conformity to any specification.
  9. */
  10. package observer;
  11. import java.awt.Color;
  12. import java.awt.event.ActionListener;
  13. import java.awt.event.ActionEvent;
  14. class Button extends java.awt.Button {
  15. static final Color defaultBackgroundColor = Color.gray;
  16. static final Color defaultForegroundColor = Color.black;
  17. static final String defaultText = "cycle color";
  18. Button(Display display) {
  19. super();
  20. setLabel(defaultText);
  21. setBackground(defaultBackgroundColor);
  22. setForeground(defaultForegroundColor);
  23. addActionListener(new ActionListener() {
  24. public void actionPerformed(ActionEvent e) {
  25. Button.this.click();
  26. }
  27. });
  28. display.addToFrame(this);
  29. }
  30. public void click() {}
  31. }