1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["javax.swing.AbstractButton", "$.DefaultButtonModel"], "javax.swing.JToggleButton", ["java.awt.EventQueue", "java.awt.event.ActionEvent", "$.InputEvent", "$.ItemEvent", "javax.swing.UIManager"], function () {
3 c$ = Clazz.declareType (javax.swing, "JToggleButton", javax.swing.AbstractButton);
4 Clazz.makeConstructor (c$,
6 this.construct (null, null, false);
8 Clazz.makeConstructor (c$,
10 this.construct (null, icon, false);
11 }, "javax.swing.Icon");
12 Clazz.makeConstructor (c$,
13 function (icon, selected) {
14 this.construct (null, icon, selected);
15 }, "javax.swing.Icon,~B");
16 Clazz.makeConstructor (c$,
18 this.construct (text, null, false);
20 Clazz.makeConstructor (c$,
21 function (text, selected) {
22 this.construct (text, null, selected);
24 Clazz.makeConstructor (c$,
28 }, "javax.swing.Action");
29 Clazz.makeConstructor (c$,
30 function (text, icon) {
31 this.construct (text, icon, false);
32 }, "~S,javax.swing.Icon");
33 Clazz.makeConstructor (c$,
34 function (text, icon, selected) {
35 Clazz.superConstructor (this, javax.swing.JToggleButton, []);
36 this.setModel ( new javax.swing.JToggleButton.ToggleButtonModel ());
37 this.model.setSelected (selected);
38 this.init (text, icon);
39 }, "~S,javax.swing.Icon,~B");
40 Clazz.overrideMethod (c$, "updateUI",
42 this.setUI (javax.swing.UIManager.getUI (this));
44 Clazz.overrideMethod (c$, "getUIClassID",
46 return "ToggleButtonUI";
48 Clazz.overrideMethod (c$, "shouldUpdateSelectedStateFromAction",
53 c$ = Clazz.declareType (javax.swing.JToggleButton, "ToggleButtonModel", javax.swing.DefaultButtonModel);
54 Clazz.makeConstructor (c$,
56 Clazz.superConstructor (this, javax.swing.JToggleButton.ToggleButtonModel, []);
58 Clazz.overrideMethod (c$, "isSelected",
60 return (this.stateMask & 2) != 0;
62 Clazz.overrideMethod (c$, "setSelected",
64 var b = this.getGroup ();
66 b.setSelected (this, a);
67 a = b.isSelected (this);
68 }if (this.isSelected () == a) {
74 }this.fireStateChanged ();
75 this.fireItemStateChanged ( new java.awt.event.ItemEvent (this, 701, this, this.isSelected () ? 1 : 2));
77 Clazz.overrideMethod (c$, "setPressed",
79 if ((this.isPressed () == a) || !this.isEnabled ()) {
81 }if (a == false && this.isArmed ()) {
82 this.setSelected (!this.isSelected ());
87 }this.fireStateChanged ();
88 if (!this.isPressed () && this.isArmed ()) {
90 var c = java.awt.EventQueue.getCurrentEvent ();
91 if (Clazz.instanceOf (c, java.awt.event.InputEvent)) {
92 b = (c).getModifiers ();
93 } else if (Clazz.instanceOf (c, java.awt.event.ActionEvent)) {
94 b = (c).getModifiers ();
95 }this.fireActionPerformed ( new java.awt.event.ActionEvent (this, 1001, this.getActionCommand (), java.awt.EventQueue.getMostRecentEventTime (), b));
98 Clazz.defineStatics (c$,
99 "$uiClassID", "ToggleButtonUI");