The Artima Developer Community
Sponsored Link

Java Buzz Forum
Mastering Swing with JGoodies

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Marc Logemann

Posts: 594
Nickname: loge
Registered: Sep, 2002

Marc Logemann is founder of www.logentis.de a Java consultancy
Mastering Swing with JGoodies Posted: Oct 22, 2004 10:04 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Marc Logemann.
Original Post: Mastering Swing with JGoodies
Feed Title: Marc's Java Blog
Feed URL: http://www.logemann.org/day/index_java.xml
Feed Description: Java related topics for all major areas. So you will see J2ME, J2SE and J2EE issues here.
Latest Java Buzz Posts
Latest Java Buzz Posts by Marc Logemann
Latest Posts From Marc's Java Blog

Advertisement

The last days i was mostly in source-code and javadoc reading mode. To be honest, in the first hours of my journey, i thought that i would never really understand that framework, but slowly i am getting the whole picture and thats why i want to talk about it. I have dealt with a lot of frameworks so far, mostly in the J2EE area. Most of them require a day or two and then you can do most the things the framework has to offer. But i want to tell you a different story, a story within the most complex API in javaland: Swing. I know many J2EE developers are thinking that EJB is the toughest API to work with, but sorry, i am doing constantly both areas and Swing is IMO harder to apply correctly.

Why is Swing tough? Well, there are many many reasons. First of all, look at the API, its massive. Second, you have zillion ways of doing the same thing, a lot of them result in a maintenance nightmare. All this speaks for a Framework, not only containing Libraries, but also example applications based on that libraries mixed with best practices. Even it will sound like a paid advertisement, while i am exploring the JGoodies Swing Suite, i really know how bad my swing programming was before. Of course the programs worked, but they were not very well designed in terms of seperation and binding.

Take the general problem of binding components to Domain Models or DTOs. Most Swing applications have hundreds of custom Listeners for various components spreaded all over the application. No one really knows what kind of objects they change and its even harder to resemble them later to persist them. JGoodies took an approach with some similarities to most J2EE frameworks. By creating ViewBeans (in Struts you would say form bean) and ValueModel, you are able to bind these Bean properties directly to your Components, like JTextField or JComboBox. When you edit your GUI, you dont have to do the usual myObject.setProp(MyJTextFied.getText()); and vice versa. All the uncool mapping is gone. If you want to save your dialog, you grab your bean and do whatever you want. If you want to change a JTextField programaticly, change the underlying Model/Bean. In other words, you dont need any setText() or getText() of your JTextField anymore.

This Binding stuff can be combined with a Validation library and there is where the fun starts. Creating a validation framework is normally ultra tough because you have so many ways a component can change. To make this generic, it becomes very fast a hell lot of work, and we all learned our lessons from the home grown persistence frameworks do we? JGoodies Validation offers the foundation of a validation framework, combined with stylish ways to present the warnings and errors. In fact, Karsten provided so many examples, its somehow hard to figure out what looks best. Everyone who has ever seen his Layered feedback icons in the corner of the target components will be impressed.

But enough marketing for a library which is not free, but worth every penny. All this cool stuff comes with a price apart from the retail price. Binding and Validation is more or less a new addition into JGoodies Swing Suite and thus not too well documented. Or better said, the Javadocs are pretty good, but you cant expect big white papers or something. Its all about reading Javadocs, looking at the source tutorials and read the code. But in return, you get the most inovative Swing framework i have ever seen in my life.

Of course there is much more than just binding and validation, but these are the two recent additions and since most people know JGoodies Looks and JGoodies Forms, i wont discuss these. And its so exciting, you allways find new things in that framework that makes you "aahhh nice". But its a long way....

Read: Mastering Swing with JGoodies

Topic: Let's leak IoC/DI into standards. You miss them when they aren't there! Previous Topic   Next Topic Topic: Software Patents and

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use