e93cb5fc6b8e09c6c3a711c664375ee9f96302fe
[jalviewjs.git] / site / swingjs / j2s / javax / swing / JButton.js
1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["javax.swing.AbstractButton"], "javax.swing.JButton", ["javax.swing.DefaultButtonModel", "$.SwingUtilities", "$.UIManager"], function () {
3 c$ = Clazz.declareType (javax.swing, "JButton", javax.swing.AbstractButton);
4 Clazz.makeConstructor (c$, 
5 function () {
6 this.construct (null, null);
7 });
8 Clazz.makeConstructor (c$, 
9 function (icon) {
10 this.construct (null, icon);
11 }, "javax.swing.Icon");
12 Clazz.makeConstructor (c$, 
13 function (text) {
14 this.construct (text, null);
15 }, "~S");
16 Clazz.makeConstructor (c$, 
17 function (a) {
18 this.construct ();
19 this.setAction (a);
20 }, "javax.swing.Action");
21 Clazz.makeConstructor (c$, 
22 function (text, icon) {
23 Clazz.superConstructor (this, javax.swing.JButton, []);
24 this.setModel ( new javax.swing.DefaultButtonModel ());
25 this.init (text, icon);
26 }, "~S,javax.swing.Icon");
27 Clazz.overrideMethod (c$, "updateUI", 
28 function () {
29 this.setUI (javax.swing.UIManager.getUI (this));
30 });
31 Clazz.overrideMethod (c$, "getUIClassID", 
32 function () {
33 return "ButtonUI";
34 });
35 Clazz.defineMethod (c$, "isDefaultButton", 
36 function () {
37 var root = javax.swing.SwingUtilities.getRootPane (this);
38 if (root != null) {
39 return root.getDefaultButton () === this;
40 }return false;
41 });
42 Clazz.defineMethod (c$, "isDefaultCapable", 
43 function () {
44 return this.defaultCapable;
45 });
46 Clazz.defineMethod (c$, "setDefaultCapable", 
47 function (defaultCapable) {
48 var oldDefaultCapable = this.defaultCapable;
49 this.defaultCapable = defaultCapable;
50 this.firePropertyChangeBool ("defaultCapable", oldDefaultCapable, defaultCapable);
51 }, "~B");
52 Clazz.defineMethod (c$, "removeNotify", 
53 function () {
54 var root = javax.swing.SwingUtilities.getRootPane (this);
55 if (root != null && root.getDefaultButton () === this) {
56 root.setDefaultButton (null);
57 }Clazz.superCall (this, javax.swing.JButton, "removeNotify", []);
58 });
59 Clazz.defineMethod (c$, "paramString", 
60 function () {
61 var defaultCapableString = (this.defaultCapable ? "true" : "false");
62 return Clazz.superCall (this, javax.swing.JButton, "paramString", []) + ",defaultCapable=" + defaultCapableString;
63 });
64 Clazz.defineStatics (c$,
65 "$uiClassID", "ButtonUI");
66 });