Problem creating VE/SWT class [message #610364] |
Wed, 24 August 2005 13:12 |
Ray Turnbull Messages: 4 Registered: July 2009 |
Junior Member |
|
|
I am fairly new to Eclipse/VE but can manage VE/Swing OK. Works fine -
great product. But I am having a problem with SWT. When I create a
visual class, it compiles OK but shows nothing in the Design view. Any
components added give an error because they are generated with a no-arg
constructor. The generated code doesn't seem right to me - I include it
below. It doesn't have a constructor to add code too. Also there is no
@jve tag
package p1;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Display;
public class Example1 {
private Shell sShell = null;
/**
*
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
/* Before this is run, be sure to set up the launch
configuration (Arguments->VM Arguments)
* for the correct SWT library path in order to run with the SWT
dlls.
* The dlls are located in the SWT plugin jar.
* For example, on Windows the Eclipse SWT 3.1 plugin jar is:
* installation_directory\plugins\org.eclipse.swt.win32_
3.1.0.jar
*/
Display display = Display.getDefault();
Example1 thisClass = new Example1();
thisClass.createSShell();
thisClass.sShell.open();
while (!thisClass.sShell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
/**
* This method initializes sShell
*/
private void createSShell() {
sShell = new Shell();
sShell.setText("Shell");
sShell.setSize(new Point(300, 200));
}
}
Also all the VE examples/tutorials I can find are for RCP or plugins,
which appear to me to be addons to Eclipse itself. Is VE/SWT not
intended to be used for stand alone programs?
|
|
|
Powered by
FUDForum. Page generated in 0.03396 seconds