JEP-504
JDK 26 means the removal of the JApplet. While this class outlived its purpose, it was one of the key component to enable Swing component inside SWT.
In particular the https://www.eclipse.org/articles/Article-Swing-SWT-Integration/index.html note explains why JApplet was specifically needed:
- Must implement
RootPaneContainer (Swing requirement)
- Must inherit from
Panel, not Window (we can't add windows to containers)
- Must contain a heavyweight component (in order to enable AWT event handling requirement)
Only JApplet satisfied all three - JFrame/JDialog/JWindow all fail about "adding a window to a container".
Maybe it's as simple as making this simple replacement (java.awt.Panel is heavyweight, and it implements RootPaneContainer).
public class HeavyweightRootPaneContainer extends Panel implements RootPaneContainer {
private final JRootPane rootPane = new JRootPane();
public HeavyweightRootPaneContainer() {
super(new BorderLayout());
add(rootPane, BorderLayout.CENTER);
}
@Override
public JRootPane getRootPane() {
return rootPane;
}
@Override
public Container getContentPane() {
return rootPane.getContentPane();
}
@Override
public void setContentPane(Container contentPane) {
rootPane.setContentPane(contentPane);
}
@Override
public JLayeredPane getLayeredPane() {
return rootPane.getLayeredPane();
}
@Override
public void setLayeredPane(JLayeredPane layeredPane) {
rootPane.setLayeredPane(layeredPane);
}
@Override
public Component getGlassPane() {
return rootPane.getGlassPane();
}
@Override
public void setGlassPane(Component glassPane) {
rootPane.setGlassPane(glassPane);
}
}
Also on the same issue:
JEP-504
JDK 26 means the removal of the
JApplet. While this class outlived its purpose, it was one of the key component to enable Swing component inside SWT.In particular the https://www.eclipse.org/articles/Article-Swing-SWT-Integration/index.html note explains why
JAppletwas specifically needed:RootPaneContainer(Swing requirement)Panel, notWindow(we can't add windows to containers)Only
JAppletsatisfied all three -JFrame/JDialog/JWindowall fail about "adding a window to a container".Maybe it's as simple as making this simple replacement (
java.awt.Panelis heavyweight, and it implementsRootPaneContainer).Also on the same issue: