-package javajs.swing;\r
-\r
-public class JMenuItem extends AbstractButton {\r
-\r
- public final int btnType;\r
- \r
- public static final int TYPE_SEPARATOR = 0;\r
- public static final int TYPE_BUTTON = 1;\r
- public static final int TYPE_CHECKBOX = 2;\r
- public static final int TYPE_RADIO = 3;\r
- public static final int TYPE_MENU = 4;\r
-\r
-\r
- public JMenuItem(String text) {\r
- super("btn");\r
- setText(text);\r
- btnType = (text == null ? 0 : 1);\r
- }\r
-\r
- public JMenuItem(String type, int i) {\r
- super(type);\r
- btnType = i;\r
- }\r
-\r
- @Override\r
- public String toHTML() {\r
- return htmlMenuOpener("li")\r
- + (text == null ? "" : "<a>" + htmlLabel() + "</a>") + "</li>";\r
- }\r
-\r
- @Override\r
- protected String getHtmlDisabled() {\r
- return " class=\"ui-state-disabled\""; \r
- }\r
-\r
- private String htmlLabel() {\r
- return (btnType == TYPE_BUTTON ? text \r
- : "<label><input id=\"" + id + "-" + (btnType == TYPE_RADIO ? "r" : "c") \r
- + "b\" type=\""\r
- + (btnType == TYPE_RADIO ? "radio\" name=\"" + htmlName : "checkbox")\r
- + "\" " + (selected ? "checked" : "") + " />" \r
- + text + "</label>");\r
- }\r
-\r
-\r
-}\r
+package javajs.swing;
+
+public class JMenuItem extends AbstractButton {
+
+ public final int btnType;
+
+ public static final int TYPE_SEPARATOR = 0;
+ public static final int TYPE_BUTTON = 1;
+ public static final int TYPE_CHECKBOX = 2;
+ public static final int TYPE_RADIO = 3;
+ public static final int TYPE_MENU = 4;
+
+
+ public JMenuItem(String text) {
+ super("btn");
+ setText(text);
+ btnType = (text == null ? 0 : 1);
+ }
+
+ public JMenuItem(String type, int i) {
+ super(type);
+ btnType = i;
+ }
+
+ @Override
+ public String toHTML() {
+ return htmlMenuOpener("li")
+ + (text == null ? "" : "<a>" + htmlLabel() + "</a>") + "</li>";
+ }
+
+ @Override
+ protected String getHtmlDisabled() {
+ return " class=\"ui-state-disabled\"";
+ }
+
+ private String htmlLabel() {
+ return (btnType == TYPE_BUTTON ? text
+ : "<label><input id=\"" + id + "-" + (btnType == TYPE_RADIO ? "r" : "c")
+ + "b\" type=\""
+ + (btnType == TYPE_RADIO ? "radio\" name=\"" + htmlName : "checkbox")
+ + "\" " + (selected ? "checked" : "") + " />"
+ + text + "</label>");
+ }
+
+
+}