KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > java > swing > plaf > motif > MotifRadioButtonUI


1 /*
2  * @(#)MotifRadioButtonUI.java 1.22 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
8 package com.sun.java.swing.plaf.motif;
9
10 import javax.swing.*;
11 import javax.swing.border.*;
12 import javax.swing.plaf.basic.BasicRadioButtonUI JavaDoc;
13
14 import javax.swing.plaf.*;
15
16 import java.awt.*;
17
18 /**
19  * RadioButtonUI implementation for MotifRadioButtonUI
20  * <p>
21  * <strong>Warning:</strong>
22  * Serialized objects of this class will not be compatible with
23  * future Swing releases. The current serialization support is appropriate
24  * for short term storage or RMI between applications running the same
25  * version of Swing. A future release of Swing will provide support for
26  * long term persistence.
27  *
28  * @version 1.22 12/19/03
29  * @author Rich Schiavi
30  */

31 public class MotifRadioButtonUI extends BasicRadioButtonUI JavaDoc {
32
33     private static final MotifRadioButtonUI motifRadioButtonUI = new MotifRadioButtonUI();
34
35     protected Color focusColor;
36
37     private boolean defaults_initialized = false;
38     
39     // ********************************
40
// Create PLAF
41
// ********************************
42
public static ComponentUI createUI(JComponent c) {
43     return motifRadioButtonUI;
44     }
45
46     // ********************************
47
// Install Defaults
48
// ********************************
49
public void installDefaults(AbstractButton b) {
50     super.installDefaults(b);
51     if(!defaults_initialized) {
52         focusColor = UIManager.getColor(getPropertyPrefix() + "focus");
53         defaults_initialized = true;
54     }
55     }
56
57     protected void uninstallDefaults(AbstractButton b) {
58     super.uninstallDefaults(b);
59     defaults_initialized = false;
60     }
61     
62     // ********************************
63
// Default Accessors
64
// ********************************
65

66     protected Color getFocusColor() {
67     return focusColor;
68     }
69     
70     // ********************************
71
// Paint Methods
72
// ********************************
73
protected void paintFocus(Graphics g, Rectangle t, Dimension d){
74     g.setColor(getFocusColor());
75     g.drawRect(0,0,d.width-1,d.height-1);
76     }
77     
78 }
79
Popular Tags