KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > java > swing > plaf > windows > WindowsSpinnerUI


1 /*
2  * @(#)WindowsSpinnerUI.java 1.14 06/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.java.swing.plaf.windows;
9
10 import java.awt.*;
11 import java.awt.event.*;
12
13 import javax.swing.plaf.basic.*;
14 import javax.swing.plaf.*;
15 import javax.swing.*;
16
17 import com.sun.java.swing.plaf.windows.TMSchema.Part;
18
19
20
21 public class WindowsSpinnerUI extends BasicSpinnerUI {
22     public static ComponentUI createUI(JComponent c) {
23         return new WindowsSpinnerUI();
24     }
25
26     protected Component createPreviousButton() {
27     if (XPStyle.getXP() != null) {
28             JButton xpButton = new XPStyle.GlyphButton(spinner, Part.SPNP_SPINDOWN);
29         xpButton.setRequestFocusEnabled(false);
30             installPreviousButtonListeners(xpButton);
31             return xpButton;
32         }
33         return super.createPreviousButton();
34     }
35
36     protected Component createNextButton() {
37     if (XPStyle.getXP() != null) {
38             JButton xpButton = new XPStyle.GlyphButton(spinner, Part.SPNP_SPINUP);
39         xpButton.setRequestFocusEnabled(false);
40             installNextButtonListeners(xpButton);
41         return xpButton;
42         }
43         return super.createNextButton();
44     }
45
46     private UIResource getUIResource(Object JavaDoc[] listeners) {
47         for (int counter = 0; counter < listeners.length; counter++) {
48             if (listeners[counter] instanceof UIResource) {
49                 return (UIResource)listeners[counter];
50             }
51         }
52         return null;
53     }
54 }
55
56
Popular Tags