Skip to content

Commit d3bf47f

Browse files
committed
menu enable/disable for radio and checkbox items
1 parent 6b8de90 commit d3bf47f

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed
-3 Bytes
Binary file not shown.

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSCheckBoxMenuItemUI.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import javax.swing.JComponent;
44
import javax.swing.JMenuItem;
55

6+
import swingjs.api.js.DOMNode;
7+
68
public class JSCheckBoxMenuItemUI extends JSCheckBoxUI {
79

810
public JSCheckBoxMenuItemUI() {
@@ -20,4 +22,5 @@ public void installUI(JComponent jc) {
2022
menuItem = (JMenuItem) jc;
2123
super.installUI(jc);
2224
}
25+
2326
}

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSComponentUI.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,16 @@ else if (enableNodes != null)
14921492
protected void enableNode(DOMNode node, boolean b) {
14931493
if (node == null)
14941494
return;
1495+
1496+
if (isMenuItem) {
1497+
if (b) {
1498+
$(node).removeClass("ui-menu-disabled ui-state-disabled");
1499+
} else {
1500+
$(node).addClass("ui-menu-disabled ui-state-disabled");
1501+
}
1502+
return;
1503+
}
1504+
14951505
DOMNode.setAttr(node, "disabled", (b ? null : "TRUE"));
14961506
String pp = getPropertyPrefix();
14971507
if (!b && inactiveForeground == colorUNKNOWN)

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSMenuItemUI.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,5 @@ public void installUI(JComponent jc) {
4747
LookAndFeel.installColorsAndFont(jc, "MenuItem.background", "MenuItem.foreground",
4848
"MenuItem.font");
4949
}
50-
5150

52-
@Override
53-
protected void enableNode(DOMNode node, boolean b) {
54-
if (node == null)
55-
return;
56-
if (b) {
57-
$(node).removeClass("ui-menu-disabled ui-state-disabled");
58-
} else {
59-
$(node).addClass("ui-menu-disabled ui-state-disabled");
60-
}
61-
}
62-
6351
}

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSRadioButtonMenuItemUI.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import javax.swing.JComponent;
44
import javax.swing.JMenuItem;
55

6+
import swingjs.api.js.DOMNode;
7+
68
public class JSRadioButtonMenuItemUI extends JSRadioButtonUI {
79

810
public JSRadioButtonMenuItemUI() {
@@ -21,4 +23,5 @@ public void installUI(JComponent jc) {
2123
menuItem = (JMenuItem) jc;
2224
super.installUI(jc);
2325
}
26+
2427
}

0 commit comments

Comments
 (0)