Skip to main content

Java Desktop - Swing

6 replies [Last post]
meek
Offline
Joined: 2005-10-13
Points: 0

I always loved java but on the same time never liked java for any desktop application (specifically talking about swing). I have never been able to make a good swing application.

Today i watched a video regarding NetBeans 6 (developing an application - swing based)

<br />
<a href="http://www.netbeans.org/download/flash/netbeans_6_gui_builder/netbeans_6_gui_builder.html" title="http://www.netbeans.org/download/flash/netbeans_6_gui_builder/netbeans_6_gui_builder.html">http://www.netbeans.org/download/flash/netbeans_6_gui_builder/netbeans_6...</a><br />

and i am amazed with the power of swing combined with netBeans. What i wanted from you people is guide to some good programming resource and recomend me good books so that i may get able to make Rocking swing application.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mcarniel
Offline
Joined: 2007-03-04
Points: 0

Hi,

I think the same thing about swing: using swing toolkit alone makes no good swing applications! and application development costs are higher than with other languages (Delphi, VB...)
For this reason I have developed a powerful (I believe!!!) open source advanced graphics components suite to speed up the development time on web based swing applications (or no web based too).
OpenSwing project is a framework too, created to the purpose of provide a simple guide to develop stand-alone, 2 tier c/s applications, 3 tier c/s applications.

Please follow the link http://oswing.sourceforge.net/ and provide a feedback about that project!

dags
Offline
Joined: 2003-06-10
Points: 0

You are not alone. The fact is that swing applications has never been easy to write or maintain. I mean an application involving some database tables and CRUD operations. Something trivial in other environments.

There are many libraries, of course, that provide some part of the required functionality but it is up to you to "glue" things together in an IDE environment.

Now, it seems to be a hope with jsr-295 and jsr-296, netbeans support and, maybe, jdbc 4.0. Someone says it is too late, but I don't agree: better later than never.

Diego.

tarbo
Offline
Joined: 2006-12-18
Points: 0

What specifically are your problems with creating Swing applications? Do you feel that your layout lacks, or rather that the system is too difficult to put together?

Google is your friend here, especially since Sun has some good tutorials on Swing, but here are a few pointers just as well to get into "clean" Swing programming. ;)

Swing makes extensive use of LayoutManagers. Learn not to position your elements absolutely, but rather relative to eachother. Fool around with BorderLayout for starters, and check out such others like GridLayout, BoxLayout, and eventually GridBagLayout. It takes some effort, but it creates an application that can handle window resizing.

Keep your data decoupled from your presentation. A great many Swing components have a view (e.g. JList) and a model (e.g. ListModel). You'll be grateful you did this when you need to make changes later on.

Swing is event-driven. So is most any GUI. Learn to deal with events, and don't be afraid to create your own listeners/firers/types. Once your program is setup and your first windows are showing, your main thread either idles or dies.

Actions are your friend. Rather than creating buttons and menu items and so on all by themselves, create a single Action object and pass it on to those buttons and menu items. Again, you'll be grateful that you did when you suddenly have to disable or change that button [i]and[/i] that menu item.

Personally, I suggest you start with simple components and simple events. Fool around with a basic frame, pop a textfield on it, perhaps a button, play with ActionEvents and some of the less complicated API.

meek
Offline
Joined: 2005-10-13
Points: 0

Thanks for your such a brief reply. Actually i am not having problem at all, I know well about Layouts, specially BorderLayout and GridBagLayout. What i wanted to know is best practices and some example project in which some one has explained from scratch to end.

Once i saw another tutorial on the very site of making threads in Action making swing response faster, that was good approach.

evanx
Offline
Joined: 2004-12-12
Points: 0

meek, you probably want to get your hands on Scott Delap's "Desktop Java Live" book, for best practises in Swing

javaniraj
Offline
Joined: 2006-07-18
Points: 0

Thanks for all your post
It it is my feeling that when java swing program left not used for a long time it takes lots of time to recoever in windows