53 |
private static final long serialVersionUID = -1907255238954382202L; |
private static final long serialVersionUID = -1907255238954382202L; |
54 |
boolean def; |
boolean def; |
55 |
boolean is_def; |
boolean is_def; |
56 |
|
|
57 |
public JButton() |
public JButton() |
58 |
{ |
{ |
59 |
this(null, null); |
this(null, null); |
60 |
} |
} |
61 |
|
|
62 |
public JButton(Action a) |
public JButton(Action a) |
63 |
{ |
{ |
64 |
this(); |
this(); |
65 |
setAction(a); |
setAction(a); |
66 |
} |
} |
67 |
|
|
68 |
public JButton(Icon icon) |
public JButton(Icon icon) |
69 |
{ |
{ |
70 |
this(null, icon); |
this(null, icon); |
71 |
} |
} |
72 |
|
|
73 |
public JButton(String text) |
public JButton(String text) |
74 |
{ |
{ |
75 |
this(text, null); |
this(text, null); |
76 |
} |
} |
77 |
|
|
78 |
public JButton(String text, Icon icon) |
public JButton(String text, Icon icon) |
79 |
{ |
{ |
80 |
super(text, icon); |
super(text, icon); |
81 |
} |
} |
82 |
|
|
83 |
public Object[] getSelectedObjects() |
public Object[] getSelectedObjects() |
84 |
{ |
{ |
85 |
return null; |
return null; |
86 |
} |
} |
87 |
|
|
88 |
protected void configurePropertiesFromAction(Action a) |
protected void configurePropertiesFromAction(Action a) |
89 |
{ |
{ |
90 |
//Factory method which sets the AbstractButton's properties according to values from the Action instance. |
//Factory method which sets the AbstractButton's properties according to values from the Action instance. |
91 |
super.configurePropertiesFromAction(a); |
super.configurePropertiesFromAction(a); |
92 |
} |
} |
93 |
|
|
94 |
public AccessibleContext getAccessibleContext() |
public AccessibleContext getAccessibleContext() |
95 |
{ |
{ |
96 |
//Gets the AccessibleContext associated with this JButton. |
//Gets the AccessibleContext associated with this JButton. |
97 |
return null; |
return null; |
98 |
} |
} |
99 |
|
|
100 |
public String getUIClassID() |
public String getUIClassID() |
101 |
{ |
{ |
102 |
//Returns a string that specifies the name of the L&F class that renders this component. |
//Returns a string that specifies the name of the L&F class that renders this component. |
103 |
return "ButtonUI"; |
return "ButtonUI"; |
104 |
} |
} |
105 |
|
|
106 |
public boolean isDefaultButton() |
public boolean isDefaultButton() |
107 |
{ |
{ |
108 |
//Returns whether or not this button is the default button on the RootPane. |
//Returns whether or not this button is the default button on the RootPane. |
109 |
return is_def; |
return is_def; |
110 |
} |
} |
111 |
|
|
112 |
public boolean isDefaultCapable() |
public boolean isDefaultCapable() |
113 |
{ |
{ |
114 |
//Returns whether or not this button is capable of being the default button on the RootPane. |
//Returns whether or not this button is capable of being the default button on the RootPane. |
115 |
return def; |
return def; |
116 |
} |
} |
117 |
|
|
118 |
protected String paramString() |
protected String paramString() |
119 |
{ |
{ |
120 |
return "JButton"; |
return "JButton"; |
121 |
} |
} |
122 |
|
|
123 |
/** |
/** |
124 |
* Overrides JComponent.removeNotify to check if this button is currently |
* Overrides JComponent.removeNotify to check if this button is currently |
125 |
* set as the default button on the RootPane, and if so, sets the RootPane's |
* set as the default button on the RootPane, and if so, sets the RootPane's |
126 |
* default button to null to ensure the RootPane doesn't hold onto an invalid |
* default button to null to ensure the RootPane doesn't hold onto an invalid |
127 |
* button reference. |
* button reference. |
128 |
*/ |
*/ |
129 |
public void removeNotify() |
public void removeNotify() |
130 |
{ |
{ |
131 |
} |
} |
132 |
|
|
133 |
public void setDefaultCapable(boolean defaultCapable) |
public void setDefaultCapable(boolean defaultCapable) |
134 |
{ |
{ |
135 |
def = defaultCapable; |
def = defaultCapable; |
136 |
} |
} |
137 |
|
|
138 |
public void updateUI() |
public void updateUI() |
139 |
{ |
{ |
140 |
setUI((ButtonUI) UIManager.getUI(this)); |
setUI((ButtonUI) UIManager.getUI(this)); |
141 |
} |
} |
142 |
} |
} |