Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsopen a SWT form from another SWT form
https://www.eclipse.org/forums/index.php/mv/msg/146928/462517/#msg_462517
I created two SWT forms, using the VE editor class. But I did not see
anywhere a place where the explain how to open a form from another form.
I have two forms:
- "one" that has only a button,
- "two", that has a lable that says "Hell World!!!"
How do I open form "two", from form "one"?
Am I missing something?
Is there any simple tutorial that explains this things, I was not able to
find an explanation on the net.
/**
* @param args
*/
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.j ar
*/
Display display = Display.getDefault();
one thisClass = new one();
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));
btnOpen = new Button(sShell, SWT.NONE);
btnOpen.setBounds(new org.eclipse.swt.graphics.Rectangle(94,31,103,33));
btnOpen.setText("Open Form");
btnOpen.addSelectionListener(new
org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
System.out.println("widgetSelected()"); // TODO Auto-generated Event
stub widgetSelected()
}
});
}
}
--------------------------------------- form "two"
package first;