java.net member

Rechercher dans ce site

SWT Hello World, Using WindowBuilder

>> 28 January 2011

In a previous post, I have described installing WindowBuilder and a first Swing HelloWorld, using WindowBuilder, the very powerful tool given by Google , as a new open source project with major code contribution to Eclipse Foundation.

In this little tutor we will display HelloWorld, using a SWT application.


Create JFace/SWT Java Project

File menu -> New -> Other



In New Wizard -> WindowBuilder -> SWT Designer -> JFace/SWT Java Project -> Next




Give a name to your project
Click on Finish



Add an Application Window

In the tool bar -> click on the arrow in "Create new visual classes" icon -> SWT -> Application Window.

The same thing can be done by -> Right clicking the project (in Package Explorer) -> New -> Other -> WindowBuilder -> SWT Designer -> SWT -> ApplicationWindow




Enter a name, and a package for the application
Select where to put the generated content -> Finish





A click on "Design" tab opens the design view and the "Palette"





To open the Palette in it's own view -> Window menu -> Show View -> Other



Under WindowBuilder -> Palette


Change the application's title



Add a Label to the application's Window
Click the Label in the Palette -> move and click onto the window.
Modify it's text for instance in properties view.



Run the application
Right click on "HelloWorld.java" -> Run As -> Java Application



2 comments:

santosh April 6, 2012 at 1:37 PM  

how to create a password field in window builder,
please back to me as soon as you can.

Santosh Srivastava

okjavafx April 6, 2012 at 6:52 PM  

Hello,

Pretty easy, but a bit hidden
Use a Text widget. In text's properties view click on "Style" to open the expandable list > Check password > save and you're done.

You can set this by programming by using an object of Text
text.setEchoChar('*');

Hope that the answer is helpful for you

Kaesar

Post a Comment

  © Blogger template Simple n' Sweet by Ourblogtemplates.com 2009

Back to TOP