java.net member

Rechercher dans ce site

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

24 comments:

William January 26, 2011 at 2:15 AM  

Wow! Thanks for the tip, it was very useful for. I didn't know this tool before your post and now I have knowledge of a powerful tool!

Thx so much!

Sandeep January 29, 2011 at 7:01 PM  

Thanks for explaining that with screen shots.

I really liked the way tutorial is written.

http://extreme-java.blogspot.com

Anonymous,  April 20, 2011 at 11:31 PM  

Great simple "Get started" tutorial.
Thanks

chikatambun May 16, 2011 at 4:57 AM  

when do an update

An error occurred while collecting items to be installed
session context was:(profile=SDKProfile, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
Artifact not found: osgi.bundle,org.eclipse.wb.core.lib,0.9.0.r36x201105061148.
http://dl.google.com/eclipse/inst/d2wbpro/latest/3.6/plugins/org.eclipse.wb.core.lib_0.9.0.r36x201105061148.jar
Artifact not found: osgi.bundle,org.eclipse.wb.core.ui,0.9.0.r36x201105061153.

ym id/skype id: chika.tambun
cc: chika.tambun@gmail.com

chikatambun May 16, 2011 at 11:19 AM  

use this if the latest release doesn't work

http://dl.google.com/eclipse/inst/d2wbpro/beta/3.6

okjavafx May 16, 2011 at 5:54 PM  

Thanks for the comments.

WindowBuilder is scheduled to be part of Eclipse, very soon.

Why don't you try to take a look at the following URLs, if you want and update from Eclipse.

http://www.eclipse.org/windowbuilder/
http://www.eclipse.org/windowbuilder/download.php

chika May 17, 2011 at 11:25 AM  

it works through offline update, thankyou for leading the way

br

JustBoo,  June 11, 2011 at 8:03 PM  

Thank you very much.

Every time I tried to create a new project, it kept using org.eclipse.swt as the source folder. I didn't like that.

Yours is the only example I could find that showed the extra step of how to create a new project correctly.

Again, thank you.

JustBoo,  June 11, 2011 at 8:07 PM  

Thank you very much.

Every time I tried to create a new project it kept using "org.eclipse.swt" as the source folder. I didn't like that.

Yours was the only example, that I could find, that showed the correct way to make a new project.

Again, thank you.

okjavafx June 12, 2011 at 8:56 AM  

Thanks for the comment

I'm really glad, that the tutor was helpful for you

Kaesar

rowol December 6, 2011 at 11:31 PM  

Great tutorial, thanks!

With Eclipse 3.7/Indigo I had to change the repository to http://dl.google.com/eclipse/inst/d2wbpro/latest/3.7

When I just did that, some dependencies broke. I also had to add http://download.eclipse.org/releases/indigo After I added both and installed from the Google repository, the installation worked properly.

Thanks!

Anonymous,  April 15, 2012 at 4:00 AM  

Thank you for a great tutorial! Very detailed and everything a tutorial should be!

okjavafx April 15, 2012 at 9:39 AM  

Thank you for the comment and the very fine words
Kaesar

Anonymous,  September 11, 2012 at 6:18 AM  

Thank you for making this page. Very straight forward. Does not assume that I have already done the task I am looking for like some tutorials. Will definitely link to your page.

okjavafx September 11, 2012 at 9:38 AM  

Thank you for the comment. I'll do my best :)

Unknown January 21, 2013 at 10:37 AM  

Thank you for a great tutorial! Very detailed and everything a tutorial should be!

okjavafx January 21, 2013 at 11:27 AM  

Thanks so much for the comment and your kind words :)

Anonymous,  April 3, 2013 at 5:18 AM  

Thank you !!!!!!!!!!

okjavafx April 3, 2013 at 10:58 AM  

Thanks so much for the nice comment :)

okjavafx September 13, 2013 at 7:15 AM  

You're welcome.
Thanks for the fine words

Post a Comment

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

Back to TOP