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



Read more...

WindowBuilder Pro, Hello World Java Swing

>> 25 January 2011

A step by step tutor with images, Hello World Java Swing application, using WindowBuilder. This tutor describe the installation and Hello World Swing application.

WindowBuilder is a powerful and easy to use bi-directional Java GUI designer. It is composed of SWT Designer, Swing Designer and GWT Designer.

WindowBuilder Pro is built as a plug-in to Eclipse.

Very easy to use with it's WYSIWYG layout, with a drag and drop capabilities.

After Google have acquired Instantiations, WindowBuilder becomes new open source project with major code contribution to Eclipse Foundation.



Thanks Google :)









Installation :


In Eclipse -> Help menu -> Install New Software



In the text field "Work with" enter the plug-in location of your Eclipse version ( Eclipse 3.6 Helios :
http://dl.google.com/eclipse/inst/d2wbpro/latest/3.6)

Click on "Add" button




Give a name of your choice to this Repository -> Click on "OK"




In "Available Software" dialog -> Select All -> Next




Install Details -> Next





Review the license -> I accept -> Finish




Installing Software





In "Security Warning" -> Click "OK" to continue




When installation finished -> Restart Now




Hello World Swing

Create a new Java Project

File menu -> New -> Java Project




Give a name to your project in "Project name" -> Finish








In "Package Explorer" -> Right click the project name -> New -> Other




In "Select a wizard" dialog -> Select WindowBuilder -> Swing Designer -> Jframe -> Next




Enter a name for the JFrame -> Finish




HelloWorldFrame.java (the name given to the JFrame class) is opened in the editor (source). To open the Swing Designer -> Click on "Design" tab








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




Under WindowBuilder -> Palette








Add JLabel to the Frame
Click on JLabel component in the palette -> Drag to the Frame








Drop on the Frame. The JLabel is added




In the "Properties" dialog -> Modify the label's text -> Hello World Swing !!!




The source is modified. Notice the clean code.




Run the application

Right click on the project (in Package Explorer) -> Run As -> Java Application





Et voilà



Going further

Other modification to JFrame are easy made, like changing the Frame's title, icon, or adding any other components, or modifying the layout, etc.
Enjoy an easy and efficient design.



References :
http://code.google.com/javadevtools/wbpro/
http://code.google.com/javadevtools/download-wbpro.html

Read more...

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

Back to TOP