Skip to content

Commit 529d6d8

Browse files
committed
internal frame fix for no closing action and painting to desktop
1 parent 54b6144 commit 529d6d8

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed
156 Bytes
Binary file not shown.

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,13 +1695,25 @@ protected Container getContainer() {
16951695
* internal frame is being dragged.
16961696
*/
16971697
protected void paintComponent(Graphics g) {
1698-
1699-
// we need to bypass JComponent
1698+
1699+
// this is not called, I think.
17001700

17011701
paintContainer(g);
17021702

17031703
//super.paint(g);
17041704
}
1705+
1706+
@Override
1707+
public void paint(Graphics g) {
1708+
1709+
// The problem is that painting is from a dirty region request on the desktop
1710+
// we need to swith to the correct graphics.
1711+
// Could this be a problem with printing?
1712+
1713+
super.paint(getRootPane().getGraphics());
1714+
}
1715+
1716+
//boolean isJComponent;
17051717

17061718
// ======= end optimized frame dragging defence code ==============
17071719

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public boolean handleJSEvent(Object target, int eventType, Object jQueryEvent) {
175175
176176
*/
177177
{}
178-
frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
178+
frameCloserAction();
179179
return true;
180180
} else if (type.equals("mouseout")) {
181181
DOMNode.setStyles(closerNode, "background-color", toCSSString(c.getBackground()));
@@ -189,6 +189,11 @@ public boolean handleJSEvent(Object target, int eventType, Object jQueryEvent) {
189189
return false;
190190
}
191191

192+
193+
protected void frameCloserAction() {
194+
frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
195+
}
196+
192197
protected void closeFrame() {
193198
JSUtil.J2S._jsUnsetMouse(frameNode);
194199
$(frameNode).remove();
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
package swingjs.plaf;
22

3+
import java.awt.event.WindowEvent;
4+
5+
import javax.swing.JInternalFrame;
6+
37
public class JSInternalFrameUI extends JSFrameUI {
48

59
public JSInternalFrameUI() {
610
super();
711
isInternalFrame = true;
812
}
913

14+
15+
protected void frameCloserAction() {
16+
JInternalFrame jif = (JInternalFrame) frame;
17+
if(jif.isClosable())
18+
jif.doDefaultCloseAction();
19+
}
20+
21+
1022
}

0 commit comments

Comments
 (0)