Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to call a section in SWT?(I can't call a section in swt project.)
icon5.gif  How to call a section in SWT? [message #756443] Sun, 13 November 2011 11:28 Go to next message
colormegood is currently offline colormegoodFriend
Messages: 1
Registered: November 2011
Junior Member
Is it possible to call a section in a SWT Project?
After i made below java SWT project,i run a application.
but i can't find a section.

1. source

public class HelloSwt {

protected Shell shell;

* Launch the application.
* @param args
public static void main(String[] args) {
try {
HelloSwt window = new HelloSwt();;
} catch (Exception e) {

* Open the window.
public void open() {
Display display = Display.getDefault();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {

* Create contents of the window.
protected void createContents(Display display) {
shell = new Shell();
shell.setSize(450, 300);
shell.setText("SWT Application");

FormToolkit toolkit = new FormToolkit(display);
Section section = toolkit.createSection(shell, Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);

section.setText("This is the title");
section.setDescription("-= This is a description -=");


2. a result of screen image is attached.
  • Attachment: screen.JPG
    (Size: 9.28KB, Downloaded 94 times)
Re: How to call a section in SWT? [message #756654 is a reply to message #756443] Mon, 14 November 2011 15:22 Go to previous message
Lakshmi ShanmugamFriend
Messages: 275
Registered: July 2009
Location: India
Senior Member

No size is set to the section. To fix this, set a layout to your shell or set size to the section.

Lakshmi P Shanmugam
Previous Topic:NSThread.isMainThread
Next Topic:Printing a shell
Goto Forum:

Current Time: Sun May 20 14:14:21 GMT 2018

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

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

Back to the top