Skip to content

Commit 48e1fcd

Browse files
hansonrhansonr
authored andcommitted
FRAME Z-ORDER
1 parent de5c554 commit 48e1fcd

File tree

5 files changed

+37
-5
lines changed

5 files changed

+37
-5
lines changed
-1.38 KB
Binary file not shown.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,6 +1515,7 @@ public void dispose() {
15151515
*/
15161516
public void toFront() {
15171517
moveToFront();
1518+
super.toFront(); // Window
15181519
}
15191520

15201521
/**
@@ -1528,6 +1529,7 @@ public void toFront() {
15281529
*/
15291530
public void toBack() {
15301531
moveToBack();
1532+
super.toBack();
15311533
}
15321534

15331535
/**

sources/net.sf.j2s.java.core/src/swingjs/api/js/JQueryObject.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,7 @@ public interface JQueryObject {
4949

5050
public abstract void detach(); // like remove(), but does not change event settings
5151

52+
public abstract DOMNode parent();
53+
5254

5355
}

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,21 @@ public DOMNode updateDOMNode() {
117117
@SuppressWarnings("unused")
118118
DOMNode fnode = frameNode;
119119

120-
JSFunction fGetFrameParent = null;
120+
JSFunction fGetFrameParent = null;
121121
/**
122122
* @j2sNative var me = this; fGetFrameParent =
123-
* function(){me.notifyFrameMoved();return
124-
* $(fnode).parent()}
123+
*
124+
* function(x, y) {
125+
* if (arguments.length == 0) {
126+
* return $(fnode).parent();
127+
* }
128+
* var xy = me.getMoveCoords$I$I(x, y);
129+
* $($(fnode).parent()).css({ top: xy[1] + 'px', left: xy[0] + 'px' });
130+
* me.notifyFrameMoved();
131+
* return null;
132+
* };
125133
*/
126-
{
127-
}
134+
128135
JSUtil.J2S._setDraggable(titleBarNode, fGetFrameParent);
129136
titleBarNode.appendChild(titleNode);
130137
titleBarNode.appendChild(closerWrap);
@@ -145,6 +152,10 @@ public DOMNode updateDOMNode() {
145152
return domNode;
146153
}
147154

155+
public int[] getMoveCoords(int x, int y) {
156+
return new int[] {x, y};
157+
}
158+
148159
public void notifyFrameMoved() {
149160
// from JavaScript
150161
this.toFront();

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,23 @@ protected void frameCloserAction() {
1717
if(jif.isClosable())
1818
jif.doDefaultCloseAction();
1919
}
20+
21+
public int[] getMoveCoords(int x, int y) {
22+
// JInternalFrame jif = (JInternalFrame) frame;
23+
// if (jif.getDesktopPane() == null) {
24+
// // in another object
25+
// } else if (jif.getDesktopPane().getDesktopManager() == null) {
26+
// int pw = jif.getWidth();
27+
// int ph = jif.getHeight();
28+
// if (pw > 0 && ph > 0) {
29+
// x = Math.min(Math.max(0, x), pw - 20);
30+
// y = Math.min(Math.max(0, y), ph - 20);
31+
// }
32+
// }
33+
34+
return new int[] {x, y};
35+
}
36+
2037

2138

2239
}

0 commit comments

Comments
 (0)