Skip to main content



      Home
Home » Newcomers » Newcomers » ScrolledForm from a Main() method
ScrolledForm from a Main() method [message #69453] Wed, 25 May 2005 18:18
Eclipse UserFriend
Originally posted by: dgallery.accessor.com

Is it possible to created a ScrolledForm from a main method? The
following code compiles and executes, but the window comes up blank.
Thanks!

package landscape.views.forms;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;

public class LayOuter {

public static void main(String[] args) {

Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Main Layout");

LayOuter layoutDude = new LayOuter();
FormToolkit toolkit = new FormToolkit(display);
ScrolledForm form = toolkit.createScrolledForm(shell);
form.setText("Landscape Forms");

Composite body = form.getBody();
GridLayout layout = new GridLayout();
body.setLayout(layout);
layout.numColumns = 2;
Button button = toolkit.createButton(body,"A checkbox in a scrollable
form", SWT.CHECK);

shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
}
}
Previous Topic:Eclipse cannot find external Java class, compile error
Next Topic:Eclipse Startup Problem
Goto Forum:
  


Current Time: Fri Apr 25 18:44:36 EDT 2025

Powered by FUDForum. Page generated in 0.09079 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top