1 Clazz.declarePackage ("javajs.awt");
2 Clazz.load (null, "javajs.awt.Component", ["javajs.util.CU"], function () {
3 c$ = Clazz.decorateAsClass (function () {
12 this.mouseListener = null;
17 this.renderHeight = 0;
18 Clazz.instantialize (this, arguments);
19 }, javajs.awt, "Component");
20 Clazz.defineMethod (c$, "setParent",
24 Clazz.makeConstructor (c$,
26 this.id = javajs.awt.Component.newID (type);
27 if (type == null) return;
29 SwingController.register(this, type);
31 c$.newID = Clazz.defineMethod (c$, "newID",
33 return type + ("" + Math.random ()).substring (3, 10);
35 Clazz.defineMethod (c$, "setBackground",
38 }, "javajs.api.GenericColor");
39 Clazz.defineMethod (c$, "setText",
43 SwingController.setText(this);
45 Clazz.defineMethod (c$, "setName",
49 Clazz.defineMethod (c$, "getName",
53 Clazz.defineMethod (c$, "getParent",
57 Clazz.defineMethod (c$, "setPreferredSize",
58 function (dimension) {
59 this.width = dimension.width;
60 this.height = dimension.height;
61 }, "javajs.awt.Dimension");
62 Clazz.defineMethod (c$, "addMouseListener",
64 this.mouseListener = listener;
66 Clazz.defineMethod (c$, "getText",
70 Clazz.defineMethod (c$, "isEnabled",
74 Clazz.defineMethod (c$, "setEnabled",
76 this.enabled = enabled;
78 SwingController.setEnabled(this);
80 Clazz.defineMethod (c$, "isVisible",
84 Clazz.defineMethod (c$, "setVisible",
86 this.visible = visible;
88 SwingController.setVisible(this);
90 Clazz.defineMethod (c$, "getHeight",
94 Clazz.defineMethod (c$, "getWidth",
98 Clazz.defineMethod (c$, "setMinimumSize",
100 this.minWidth = d.width;
101 this.minHeight = d.height;
102 }, "javajs.awt.Dimension");
103 Clazz.defineMethod (c$, "getSubcomponentWidth",
107 Clazz.defineMethod (c$, "getSubcomponentHeight",
111 Clazz.defineMethod (c$, "getCSSstyle",
112 function (defaultPercentW, defaultPercentH) {
113 var width = (this.renderWidth > 0 ? this.renderWidth : this.getSubcomponentWidth ());
114 var height = (this.renderHeight > 0 ? this.renderHeight : this.getSubcomponentHeight ());
115 return (width > 0 ? "width:" + width + "px;" : defaultPercentW > 0 ? "width:" + defaultPercentW + "%;" : "") + (height > 0 ? "height:" + height + "px;" : defaultPercentH > 0 ? "height:" + defaultPercentH + "%;" : "") + (this.bgcolor == null ? "" : "background-color:" + javajs.util.CU.toCSSString (this.bgcolor) + ";");
117 Clazz.defineMethod (c$, "repaint",