1. /*
  2. * @(#)MotifButtonListener.java 1.13 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package com.sun.java.swing.plaf.motif;
  11. import java.awt.*;
  12. import java.awt.event.*;
  13. import javax.swing.*;
  14. import javax.swing.plaf.basic.*;
  15. import javax.swing.event.*;
  16. /**
  17. * Button Listener
  18. * <p>
  19. *
  20. * @version 1.13 02/02/00
  21. * @author Rich Schiavi
  22. */
  23. public class MotifButtonListener extends BasicButtonListener {
  24. public MotifButtonListener(AbstractButton b ) {
  25. super(b);
  26. }
  27. public void focusGained(FocusEvent e) {
  28. AbstractButton b = (AbstractButton) e.getSource();
  29. if (b instanceof JButton && ((JButton)b).isDefaultCapable()) {
  30. // Only change the default button IF the root pane
  31. // containing this button has a default set.
  32. JRootPane root = SwingUtilities.getRootPane(b);
  33. if (root != null) {
  34. JButton current = root.getDefaultButton();
  35. if (current != null) {
  36. root.setDefaultButton((JButton)b);
  37. }
  38. }
  39. }
  40. b.repaint();
  41. }
  42. /*
  43. // Here for rollover purposes
  44. public void mouseEntered(MouseEvent e) {
  45. AbstractButton button = (AbstractButton)e.getSource();
  46. button.getModel().setRollover(true);
  47. }
  48. // Here for rollover purposes
  49. public void mouseExited(MouseEvent e) {
  50. AbstractButton button = (AbstractButton)e.getSource();
  51. button.getModel().setRollover(false);
  52. }
  53. */
  54. protected void checkOpacity(AbstractButton b) {
  55. b.setOpaque( false );
  56. }
  57. }