|
Re: Please help on the AWT_SWT .... [message #438659 is a reply to message #438644] |
Tue, 29 June 2004 12:25 |
Eclipse User |
|
|
|
Originally posted by: elvis.graceland.com
The class name is SWT_AWT not AWT_SWT.
Here's code I used to test it out with a simple workbench view:
------------------------------------------------------------ ------
package test;
import java.awt.*;
import javax.swing.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
public class MyView extends ViewPart {
public static final String ID_VIEW = "test.MyView";
private Composite _ui;
public void createPartControl(Composite parent) {
setPartName("My Test View");
_ui = new Composite(parent, SWT.EMBEDDED);
Frame f = SWT_AWT.new_Frame(_ui);
f.add(createContent());
}
public void setFocus() {
_ui.setFocus();
}
private Component createContent() {
JPanel p = new JPanel(new BorderLayout());
p.add(new JLabel("Swing JLabel", JLabel.CENTER),
BorderLayout.NORTH);
p.add(new JTextArea(), BorderLayout.CENTER);
p.add(new JCheckBox("Swing JCheckBox"), BorderLayout.SOUTH);
return p;
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.02375 seconds