Eclipse Zone is brought to you in partnership with:

William has posted 1 posts at DZone. View Full User Profile

Visual Swing for Eclipse

11.26.2008
| 200635 views |
  • submit to reddit

Visual Swing for Eclipse is a GUI designer tool, which consists of a set of Eclipse Plug-ins. It aims to provide a Swing designer for Eclipse for Java desktop developers.

It is well known that Swing is gaining more and more momentum in recent years. Before Java 1.5, Swing was ugly, slow and full of bugs. In fact, it used to be so bad, that IBM created another GUI toolkit named SWT, on which Eclipse was built. SWT was a great success. Sun felt the pressure from Eclipse. Since Java 1.5, Sun has been improving Swing. The Swing team made a lot of progress and Swing is winning back its lost ground. Actually, it won the No. 1 in GUI toolkit market three years ago. At that time, there was a market research report given by Evans Data Corporation that Swing is the dominant GUI Toolkit for Northern American developers. The following statement is quoted from one of Hans Muller's blog. It was excerpted from the report:

"Java Swing with 47% use, has surpassed WinForms? as the dominant GUI development toolkit, an increase of 27% since fall 2004."
(http://weblogs.java.net/blog/hansmuller/archive/2005/10/official_swing.html)

As a Swing lover, I am very happy to witness the progress on Swing in recent years. The latest good news about Swing is the newly released Java 6 update 10, namely the consumer JRE. If you don't know what Java 6 update 10 is and what it has do with Swing, please take a look at the following page:

http://java.sun.com/developer/technicalArticles/javase/java6u10

For a long time, GUI development in Java is very weak. One of the reasons is that Swing lacks good GUI designers. The Matisse Project in NetBeans brought hopes to swing developers. But we are very sad to notice that although Eclipse dominates the Java IDE market, but it lacks a good open source designer. Although it used to have one, ie. VE, it was painful to use. Now this project seems to be abandoned by eclipse. Of course there are some commercial tools in the market. But they are either not free or not open sourced. Developers using Eclipse for free have to manually code swing applications.

This project is determined to produce a free, open-sourced and Netbeans-like GUI designer for the Eclipse IDE. It now has the following features:

  1. Designing Swing component like NetBeans visual designer, especially the component layout, providing similar anchors, baselines and layout hints etc.
  2. Generating and parsing java code without the help of .form file. The code generated is readable, like those of VE(visual editor of eclipse).
  3. Look and feel support during design, preview and the generated code.
  4. Visual tree and table designing. It is very intuitive to design tree and table in this tool. What you need is only drag and drop a table/tree, and invoke the in-place editor to add or delete rows or columns or editing data in the table, etc.
  5. Provide visual menu designer. This is not a structural designing like those of other designers. You can drag and drop menu items directly on to the form. The look and feel is exactly what you get.
  6. Responsive and fast. This toolkit uses the same JVM with eclipse. And code generation follows editing-save-editing cycle. Therefore it is very responsive and fast.

NOTE that the latest version requires Eclipse 3.4 or Eclipse 3.4.1. The java runtime environment requires to be Java 6. If you want to test Nimbus look and feel, you should install java 6 update 10.

Here are some screenshots taken on windows:

Drag&Drop, Anchors and Baselines

Coding while designing

Switch LookAndFeels In-place Editor for JTable

Menu Designer Multi-selection support

This project is released under EPL v1.0(Eclipse Public License) so that everyone can freely get the source code and make contributions back.

Why not just download and have a try? Please don't hesitate to tell me your feedback.

 


Location: 
http://code.google.com/p/visualswing4eclipse/
AttachmentSize
5_set_look_and_feel.jpg158.5 KB
6_menu_designer.jpg139.13 KB
7_visually_designing_table.jpg141.24 KB
4_coding_while_designing.jpg137.67 KB
2_typical_designing_case.jpg146.25 KB
button_group_support.png73 KB
0
Published at DZone with permission of its author, William Chen.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Raffaele Gambelli replied on Wed, 2008/11/26 - 3:30am

Finally a GUI designer tool for free!!! Thanks guys!

 

Many many people and societies choose NetBeans for this Eclipse lack!

Bye

Naiden Gochev replied on Wed, 2008/11/26 - 7:03am

very very nice :) it looks awesome as soon it has eclipse update site i will install it. :) it looks nice on the screenshots :). Just please add Eclipse update site.

Eric Bresie replied on Wed, 2008/11/26 - 7:44am

Looks promising...

 

That being said, as I understand it, VE is not dead per say, it is just not seeing much support from the community.  Having not looked at the source for it, I can't say if tossing it and replacing it would make more sense or if supporting development would have been better.

Johan Compagner replied on Wed, 2008/11/26 - 10:13am

why LGPL? thats one of the licenses that is not compartible with eclipse style licenses so if you want to really contribute to it or eventually maybe be under that flag then that would be a big problem (and you have to transfer the License, which must all committers then agree with)

Alex Ruiz replied on Wed, 2008/11/26 - 1:04pm

It looks really nice. I haven't tried it yet (I will soon,) but it seems to have what I was looking for, Matisse-like feel while generating Java code! No .form files...sweet!

Thanks for creating this tool! :)

Cheers,

-Alex

 

William Chen replied on Wed, 2008/11/26 - 9:14pm

Hi Johan,

I hesitated a lot about what license to choose when I was planning to open source this project. Actually I am the only developer of the project currently. I wrote most of the code except several source files. Therefore, I think I own the copy right.  What do you think which license I should choose? I want this project to benifit the whole communtiy and encourage others to contribute to it. But I am not famillar with these copy right stuff. 

 -William 

Eric Clayberg replied on Wed, 2008/11/26 - 8:52pm

Note that Instantiations does offer a free version of its commercial Swing Designer (tm) tool. Free licenses are also available to committers on any open source project (we have given away hundreds of licenses that way). Swing Designer is well known for providing robust bi-direction code generation and reverse engineering of code created by any other tool. It will even reverse engineer .java files generated by NetBeans and does not require any type of redundant .form file. We also offer numerous code generation options, full internationalization support, support for visual inheritance, support for a wide variety of layout managers (including JDK 1.6 GroupLayout, JGoodies FormLayout, etc.), support for arbitrary code modifications & refactoring, etc.

Johan Compagner replied on Thu, 2008/11/27 - 3:23am in response to: William Chen

[quote=rehte]

Hi Johan,

I hesitated a lot about what license to choose when I was planning to open source this project. Actually I am the only developer of the project currently. I wrote most of the code except several source files. Therefore, I think I own the copy right.  What do you think which license I should choose? I want this project to benifit the whole communtiy and encourage others to contribute to it. But I am not famillar with these copy right stuff. 

 -William 

[/quote]

 

Its just that if i would create an open source eclipse plugin i would go for EPL because that matches way better to eclipse base itself. (L)GPL code is not allowed in the code base of Eclipse itself so if at someday you wanted it to be part of eclipse you have to do a licence change.

  EPL is a weak copy left license (lgpl also i think and gpl is a strong copy left) which means that with EPL everybody that is changing your code must license it under EPL but they can build on top of it and license that something else. Strong copy left means that even that last one isnt possible it also must become that GPL license.

LGPL is a bit fuzzy always in my eyes. because it is a weak copy left as far  as i know but it has some other more restrictive things like all the code that uses this is therefore allowed  to be reverse engineerd.

 Ofcousre you could go for MIT or BSD style licenses that means you can do what ever you want with it (no copy left what so ever) or another weak copy left which is pretty compartible with eclipse like Apache.

 if you would like later on the be included in the eclipse project itself then change the license to EPL and keep track over everybody that also contributes to your project and let them sign stuff that they agree with the EPL license. So that later on there is no problem in code ownership.

Stefano Castagnoli replied on Sun, 2008/11/30 - 6:18am

I really like it, Very cool!

Anyway using XP PRO SP2 I have problems in form visualiaztion. I see only bad graphics but the Java is correcly generated.

You can see a screenshot of what I see at: http://www.scastagnoli.info/XP_error.png

Thank you a lot in advance.

William Chen replied on Tue, 2008/12/02 - 5:07am in response to: Stefano Castagnoli

scastagnoli, 

Thank you for feedback. I don't know what's wrong with the error you reported either. What's your configuration: JRE, eclipse and JVM argument? It seems to be an issue of Swing or SWT_AWT bridge.

Recently I am refactoring the code. I have changed the code so much that I am sure there will be many regressional bugs.

Anyway thanks for your feedback and I am very happy that you like it. Please continue to report issues.  

-William 

Stefano Castagnoli replied on Tue, 2008/12/02 - 1:01pm in response to: William Chen

Thank you for your reply William.

I'm using version 1.6.0_10:
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

Eclipse version is 3.4.1.

Mine is a very simple installation, I only have used the binaries from Sun website.

Please, I'm sure it could be very usefull for a lot of people to use your plug-in, help me! :-) 

But so far, thank you very very much for your job!

William Chen replied on Fri, 2008/12/05 - 5:39am in response to: Stefano Castagnoli


scastagnoli , Having studied for a long time, I still couldn't reproduce  what you reported. Sorry, I don't know what's wrong with your setup. Did you download the latest version? Does it work for you?  -William 

Stefano Castagnoli replied on Mon, 2008/12/08 - 9:26am

Hi William,

I've tried on another PC running same Win version, same JRE and same Eclipse and it works perferctly.

I cannot make it work with my notebook also with the latest version you realised today, I have the same problem.

I have a ATI RADEON 9700 on my notebook with resolution 1400x1050.

I've changed resolution but nothing has changed.

Could it be a problem with my video card?

William Chen replied on Mon, 2008/12/08 - 8:46pm

Hi scastagnoli,

I am almost sure this is a bug of ATI driver card. I remember there is swing bug here:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5095398

 In this bug description, the submitter mentioned that his computer is also a laptop/notebook with ATI 9700M. A sun swing engineer thinks it is a ATI driver bug which in turn influences swing performance. You may look at this bug and see if it is the same with yours.

BTW, I used SWT_AWT bridge to embed the swing component designer.  

-William 

William Chen replied on Mon, 2008/12/08 - 11:23pm

Hi Johan,

I've changed the license to EPL v1.0. Thanks for your detailed answer!

 -William 

Jesse McColm replied on Tue, 2008/12/09 - 1:15am

Hey I'm kinda new to eclipse and to java really. I was just wondering if you could help me figure out how to use this plugin. I have the palette opened but can't seem to do much of anything other than look at the different forms and what not. I'm running this on ubuntu. Any help would be much appreciated, maybe even a short tutorial?

 EDIT: Messing around with it on my windows machine I think I have it figured out!

 Thanks!

Bretislav Wajtr replied on Wed, 2008/12/17 - 7:23am

Hi William,

    I'm really exited about your project. My todays task is to make a decision what GUI builder we will be using for our projects and I have to say that your project is second best - if the would be THE best if there would be some way how to edit gridbaglayout constraints - at least I didn't find it. Unfortunately GroupLayout is not the right choice for our needs. Btw if there really isn't anything to edit GridBagLayout constraints - please please please do it same way as it is in NetBeans, it's really simple and extremly usable there. Today I tried several products and nothing is so user friendly as your builder and designer in netbeans. I'm your fan... keep working... 

   Breta, Czech Republic 

William Chen replied on Thu, 2008/12/25 - 4:36am

Hi wajtr,

I am very glad that you like it. I had thought that group layout is enough for common tasks and that few people still use GridBagLayout. Therefore, I did not  spend too much time on it. I'll take time to polish its implementation, adding more functionalities for it. But I need some time. Thanks for your feedback:-)

 -William 

Muhammad Iqbal replied on Wed, 2009/06/24 - 2:44am

Hi,

I am unable to install visual swing for eclipse. I encounter an error "No repository found at http://visualswing4eclipse.googlecode.com/svn/trunk/org.dyno.visual.swing.site/" every time when i try to install plug-in in eclipse.

I am using eclipse 3.4.1 and JRE 6.

Appreciate your help.

Regards,
Iqbal

Apellido Materno replied on Thu, 2009/11/26 - 1:13pm

Hi, Does this licence allows me to use this API in production?

Ramakant Singh replied on Tue, 2010/12/28 - 5:30am

HI William,

 

Its amazing,that's what I wanted. Great stuf!

 

I have few queries on this project.

1. As I can see your project is under EPL v1.0. So can I use source code of your project for our development work?

2. Do we need any aproval before start using it?

3. Can i create a seperate eclipse plugin by using some of your code base and extending this according to our project need? 

4. Do you have any document regarding the projects which can guide us on the code flow? If yes, could you please share with us.

 

Please reply back as we need to start on our project development and it seems like your code base can help us in greater extend.

 Thanks in advance.

 

Regards,

Ramakant

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.