Skip to content

Commit 404b1d2

Browse files
authored
Merge pull request #88 from BobHanson/hanson1
Hanson1
2 parents 19adf25 + fc6183d commit 404b1d2

File tree

16 files changed

+715
-62
lines changed

16 files changed

+715
-62
lines changed
1.16 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190316185356
1+
20190319211418
1.16 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190316185356
1+
20190319211418
1.16 KB
Binary file not shown.

sources/net.sf.j2s.java.core/src/java/awt/Component.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,17 +2385,15 @@ protected Dimension prefSizeComp() {
23852385
Dimension dim = prefSize;
23862386
if (dim == null || !(isPreferredSizeSet() || isValid())) {
23872387
// synchronized (getTreeLock()) {
2388-
2389-
// SwingJS TODO: it is not clear that we should deliver getMinimumSize here.
2390-
//
2391-
prefSize = // (
2388+
dim = (width != 0 || height != 0 ? null
2389+
: isDisplayable() ? //
23922390
// peer != null) ?
2393-
// peer.preferredSize() :
2394-
(width == 0 && height == 0 ? getMinimumSize() : new Dimension(width, height));
2395-
dim = prefSize;
2391+
peer.getPreferredSize() :
2392+
getMinimumSize());
2393+
prefSize = dim;
23962394
}
23972395
// }
2398-
return new Dimension(dim);
2396+
return (dim == null ? new Dimension(width, height) : new Dimension(dim));
23992397
}
24002398

24012399
/**

sources/net.sf.j2s.java.core/src/java/awt/peer/ComponentPeer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,8 @@ public interface ComponentPeer {
9090

9191
Point getLocationOnScreen();
9292

93-
// SwingJS -- never called by Java
9493
Dimension getPreferredSize();
95-
//
94+
9695
Dimension getMinimumSize();
9796

9897
ColorModel getColorModel();

sources/net.sf.j2s.java.core/src/javax/swing/JTextArea.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import javax.swing.text.Element;
4040
import javax.swing.text.JTextComponent;
4141
import javax.swing.text.PlainDocument;
42-
4342
import swingjs.api.JSMinimalAbstractDocument;
4443

4544
/**
@@ -240,8 +239,6 @@ public String getUIClassID() {
240239
* @return the default document model
241240
*/
242241
protected Document createDefaultModel() {
243-
// SwingJS
244-
// return JSToolkit.getPlainDocument(this);
245242
return new PlainDocument();
246243
}
247244

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2958,7 +2958,7 @@ public Insets getInsets() {
29582958

29592959
@Override
29602960
public void beginValidate() {
2961-
System.out.println("JSCUI beginValidate " + id);
2961+
//System.out.println("JSCUI beginValidate " + id);
29622962
}
29632963

29642964
@Override

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

Lines changed: 52 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ public JSFrameUI() {
5959
}
6060

6161

62-
protected void selected() {
63-
((JFrame) jc).toFront();
64-
}
65-
6662
// public void notifyFrameMoved() {
6763
// Toolkit.getEventQueue().postEvent(new ComponentEvent(frame,
6864
// ComponentEvent.COMPONENT_MOVED));
@@ -119,36 +115,7 @@ public DOMNode updateDOMNode() {
119115
DOMNode.setTopLeftAbsolute(modalNode, 0, 0);
120116
DOMNode.setSize(modalNode, screen.width, screen.height);
121117
}
122-
// we have to wait until the frame is wrapped.
123-
@SuppressWarnings("unused")
124-
DOMNode fnode = frameNode;
125-
126-
JSFunction fGetFrameParent = null;
127-
/**
128-
* @j2sNative var me = this;
129-
* fGetFrameParent = function(mode, x, y) {
130-
* switch(arguments.length) {
131-
* case 1:
132-
* if (mode == 501)
133-
* me.selected$();
134-
* me.hideMenu$();
135-
* return $(fnode).parent();
136-
* case 3:
137-
* if (mode == 506) {
138-
* me.moveFrame$I$I(x, y);
139-
* return null;
140-
* }
141-
* }
142-
*
143-
* return null;
144-
* }
145-
*/
146-
{
147-
hideMenu();
148-
}
149-
150-
151-
J2S.setDraggable(titleBarNode, fGetFrameParent);
118+
setDraggableEvents();
152119
titleBarNode.appendChild(titleNode);
153120
titleBarNode.appendChild(closerWrap);
154121
closerWrap.appendChild(closerNode);
@@ -173,7 +140,51 @@ public DOMNode updateDOMNode() {
173140
return domNode;
174141
}
175142

143+
@Override
144+
protected void setDraggableEvents() {
145+
@SuppressWarnings("unused")
146+
DOMNode fnode = frameNode;
147+
JSFunction fGetFrameParent = null;
148+
/**
149+
* @j2sNative var me = this;
150+
* fGetFrameParent = function(mode, x, y) {
151+
* switch(arguments.length) {
152+
* case 1:
153+
* if (mode == 501)
154+
* me.selected$();
155+
* me.hideMenu$();
156+
* return $(fnode).parent();
157+
* case 3:
158+
* if (mode == 506) {
159+
* me.moveFrame$I$I(x, y);
160+
* return null;
161+
* }
162+
* }
163+
*
164+
* return null;
165+
* }
166+
*/
167+
{
168+
selected();
169+
moveFrame(0,0);
170+
hideMenu();
171+
}
172+
173+
J2S.setDraggable(titleBarNode, fGetFrameParent);
174+
}
175+
176+
176177
/**
178+
* Do not change this method name
179+
* referenced by j2sNative, above
180+
*/
181+
protected void selected() {
182+
// subclassed by JSInternalFrameUI
183+
((JFrame) jc).toFront();
184+
}
185+
186+
/**
187+
* Do not change this method name
177188
* referenced by j2sNative, above
178189
*/
179190
/*not private*/ void hideMenu() {
@@ -182,7 +193,13 @@ public DOMNode updateDOMNode() {
182193

183194

184195

185-
void moveFrame(int x, int y) {
196+
/**
197+
* Do not change this method name
198+
* referenced by j2sNative, above
199+
* @param x
200+
* @param y
201+
*/
202+
/*not private*/ void moveFrame(int x, int y) {
186203
if (!isInternalFrame) {
187204
x = Math.max(30 - frame.getWidth(), x);
188205
y = Math.max(0, y);

0 commit comments

Comments
 (0)