Ancora io
Non voglio essere tedioso con questo Post (anzi.. lo sono.. vabbè), ma ho avuto modo di approfondire la cosa, purtroppo senza avere i famigerati sorgenti (cosa impossibile, pare).
Comunque, dopo varie prove sono riuscito ad ottenere, con un esempietto, una struttura che risponde a questa struttura (via Spy++)
SWT_Windows0
- SWT_Windows0
- - SunAwtFrame
- - - SunAwtCanvas
Dove, come dicevi tu, l'oggetto SWT_Windows0 deriva dal fatto di utilizzare SWT nel mio bel progetto sotto Eclipse.
Il tutto deriva da questo codice:
codice:
import java.awt.*;
import javax.swing.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
/**
* @author core
*
*/
public class SwgDummy {
/**
* @param args
*/
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
Composite composite = new Composite(shell, SWT.NO_BACKGROUND
| SWT.EMBEDDED);
/*
* Set a Windows specific AWT property that prevents heavyweight
* components from erasing their background. Note that this is a global
* property and cannot be scoped. It might not be suitable for your
* application.
*/
try {
System.setProperty("sun.awt.noerasebackground", "true");
}
catch (NoSuchMethodError error) {
}
/* Create and setting up frame */
Frame frame = SWT_AWT.new_Frame(composite);
Panel panel = new Panel(new BorderLayout()) {
public void update(java.awt.Graphics g) {
/* Do not erase the background */
paint(g);
}
};
frame.add(panel);
JRootPane root = new JRootPane();
panel.add(root);
Container contentPane = root.getContentPane();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
"Sento" che mi sto avvicinando al "mistero" della struttura dell'applicazione x, anche se non è proprio la stessa desiderata.
In particolare, non capisco come una JFrame possa essere child del Frame AWT principale.. o almeno, a guardare la struttura così mi viene da pensare
SWG_Window0
- SWG_Window0
- - javax.swing.JFrame
- - - SunAwtCanvas
Penso proprio le applet non c'entrino nulla e che questo famigerato SunAwtCanvas non sia altro che un contenitore, frame particolare o simile.. non so bene ancora il suo contesto.
Posto.. nella speranza di avere altri pareri su questa cosa...
Gra'