1. /*
  2. * @(#)WindowsSpinnerUI.java 1.12 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.java.swing.plaf.windows;
  8. import java.awt.*;
  9. import java.awt.event.*;
  10. import javax.swing.plaf.basic.*;
  11. import javax.swing.plaf.*;
  12. import javax.swing.*;
  13. public class WindowsSpinnerUI extends BasicSpinnerUI {
  14. public static ComponentUI createUI(JComponent c) {
  15. return new WindowsSpinnerUI();
  16. }
  17. protected Component createPreviousButton() {
  18. if (XPStyle.getXP() != null) {
  19. JButton xpButton = new XPStyle.GlyphButton("spin.down");
  20. xpButton.setRequestFocusEnabled(false);
  21. installPreviousButtonListeners(xpButton);
  22. return xpButton;
  23. }
  24. return super.createPreviousButton();
  25. }
  26. protected Component createNextButton() {
  27. if (XPStyle.getXP() != null) {
  28. JButton xpButton = new XPStyle.GlyphButton("spin.up");
  29. xpButton.setRequestFocusEnabled(false);
  30. installNextButtonListeners(xpButton);
  31. return xpButton;
  32. }
  33. return super.createNextButton();
  34. }
  35. private UIResource getUIResource(Object[] listeners) {
  36. for (int counter = 0; counter < listeners.length; counter++) {
  37. if (listeners[counter] instanceof UIResource) {
  38. return (UIResource)listeners[counter];
  39. }
  40. }
  41. return null;
  42. }
  43. }