Wizard page's content does not show in a standalone JFace/SWT application [message #538178] |
Sun, 06 June 2010 01:15  |
Eclipse User |
|
|
|
I have a standalone JFace/SWT application which will show a wizard dialog. in the wizard page, if i create a child composite to contain the controls, the controls don't show. but if i just directly create the control to the parent composite, it can show correctly. the code is as below:
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
public class Test extends ApplicationWindow {
class MyPage extends WizardPage {
protected MyPage(String pageName) {
super(pageName);
}
@Override
public void createControl(Composite parent) {
/** the button will never show in the child composite */
// Composite composite = new Composite(parent, SWT.NULL);
//
// Button button = new Button(composite,SWT.PUSH);
// button.setText("hello");
// setControl(composite);
/*********************************************************/
//the button can show if its container is the parent!
Button button = new Button(parent,SWT.PUSH);
button.setText("hello");
setControl(parent);
}
}
class MyWizard extends Wizard {
@Override
public void addPages() {
MyPage page = new MyPage("test");
this.addPage(page);
}
@Override
public boolean performFinish() {
// TODO Auto-generated method stub
return false;
}
}
/**
* @param parentShell
*/
public Test(Shell parentShell) {
super(parentShell);
}
public static void main(String[] args) {
Test window = new Test(null);
window.setBlockOnOpen(false);
window.open();
WizardDialog dialog = new WizardDialog(window.getShell(), window.new MyWizard());
dialog.open();
}
}
any suggestions are appreciated!
|
|
|
|
|
Powered by
FUDForum. Page generated in 1.07614 seconds