41 |
import javax.accessibility.AccessibleContext; |
import javax.accessibility.AccessibleContext; |
42 |
import javax.swing.plaf.ButtonUI; |
import javax.swing.plaf.ButtonUI; |
43 |
|
|
44 |
|
|
45 |
/** |
/** |
46 |
* An instance of JButton can be added to a panel, frame etc |
* An instance of JButton can be added to a panel, frame etc |
47 |
* |
* |
48 |
* @author Ronald Veldema (rveldema@cs.vu.nl) |
* @author Ronald Veldema (rveldema@cs.vu.nl) |
49 |
*/ |
*/ |
50 |
public class JButton extends AbstractButton implements Accessible |
public class JButton extends AbstractButton |
51 |
|
implements Accessible |
52 |
{ |
{ |
53 |
private static final long serialVersionUID = -1907255238954382202L; |
private static final long serialVersionUID = -1907255238954382202L; |
54 |
|
boolean def; |
55 |
boolean def, is_def; |
boolean is_def; |
|
|
|
56 |
|
|
57 |
public JButton() |
public JButton() |
58 |
{ |
{ |
99 |
|
|
100 |
public String getUIClassID() |
public String getUIClassID() |
101 |
{ |
{ |
102 |
//Returns a string that specifies the name of the Look and Feel |
//Returns a string that specifies the name of the L&F class that renders this component. |
|
//class that renders this component. |
|
103 |
return "ButtonUI"; |
return "ButtonUI"; |
104 |
} |
} |
105 |
|
|
120 |
return "JButton"; |
return "JButton"; |
121 |
} |
} |
122 |
|
|
123 |
|
/** |
124 |
|
* 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 |
126 |
|
* default button to null to ensure the RootPane doesn't hold onto an invalid |
127 |
|
* button reference. |
128 |
|
*/ |
129 |
public void removeNotify() |
public void removeNotify() |
130 |
{ |
{ |
|
//Overrides JComponent.removeNotify to check if this button is currently set as the default button on the RootPane, and if so, sets the RootPane's default button to null to ensure the RootPane doesn't hold onto an invalid button reference. |
|
131 |
} |
} |
132 |
|
|
133 |
public void setDefaultCapable(boolean defaultCapable) |
public void setDefaultCapable(boolean defaultCapable) |
134 |
{ def = defaultCapable; } |
{ |
135 |
|
def = defaultCapable; |
136 |
|
} |
137 |
|
|
138 |
public void updateUI() |
public void updateUI() |
139 |
{ |
{ |
140 |
ButtonUI b = (ButtonUI)UIManager.getUI(this); |
setUI((ButtonUI) UIManager.getUI(this)); |
|
setUI(b); |
|
141 |
} |
} |
142 |
} |
} |