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();
window.open();
} catch (Exception e) {
e.printStackTrace();
}
}

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

/**
* 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 146 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 P ShanmugamFriend
Messages: 279
Registered: July 2009
Location: India
Senior Member
Hi,

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: Mon Sep 23 23:27:14 GMT 2024

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

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

Back to the top