Skip to content

Commit 12a032c

Browse files
committed
better handling of Frame-embedded JApplet
1 parent 8b64794 commit 12a032c

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ public interface A2SWrappedComponent {
105105
*/
106106
public Action 秘keyAction;
107107

108-
protected boolean 秘isAppletFrame;
109-
public boolean 秘isFramedApplet;
108+
// protected boolean 秘isAppletFrame;
109+
// public boolean 秘isFramedApplet;
110110

111111
public String 秘htmlName;
112112

@@ -746,6 +746,7 @@ protected boolean canPaint() {
746746
// applet or frame or window of some sort
747747
// take just the content pane
748748
jc = (JComponent) jc.getRootPane().getContentPane();
749+
jc.秘isContentPane = false;
749750
jc.getRootPane().setContentPane(new JPanel());
750751
}
751752
jc.秘frameViewer = 秘frameViewer;

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ public class JFrame extends JSFrame implements WindowConstants,
150150
*/
151151
protected JRootPane rootPane;
152152

153-
@Override
154-
public void add(Component comp, Object constraints) {
155-
if (comp instanceof JApplet) {
156-
秘isAppletFrame = true;
157-
((JApplet) comp).getLayeredPane().秘isFramedApplet = true;
158-
}
159-
super.add(comp, constraints);
160-
}
153+
// @Override
154+
// public void add(Component comp, Object constraints) {
155+
// if (comp instanceof JApplet) {
156+
// 秘isAppletFrame = true;
157+
// ((JApplet) comp).getLayeredPane().秘isFramedApplet = true;
158+
// }
159+
// super.add(comp, constraints);
160+
// }
161161

162162
/**
163163
* If true then calls to <code>add</code> and <code>setLayout</code> will be

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828
package javax.swing;
2929

30+
import java.awt.Component;
3031
import java.awt.FlowLayout;
3132
import java.awt.LayoutManager;
3233

@@ -124,5 +125,19 @@ private JPanel(LayoutManager layout, boolean isDoubleBuffered, boolean isAWTCont
124125
setUIProperty("opaque", Boolean.TRUE);
125126
updateUI();
126127
}
128+
129+
@Override
130+
public Component add(Component comp) {
131+
return super.add(秘transferFrameTo((JComponent) comp));
132+
}
133+
134+
@Override
135+
public Component add(String name, Component comp) {
136+
return super.add(name, 秘transferFrameTo((JComponent) comp));
137+
}
127138

139+
@Override
140+
public Component add(Component comp, int index) {
141+
return super.add(秘transferFrameTo((JComponent) comp), index);
142+
}
128143
}

0 commit comments

Comments
 (0)