473,467 Members | 1,419 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Swing Design Patterns

Having been traumatised many years ago when using MFC/C++ to develop
front-end code, I've religiously avoided GUI work since and stuck to
back-end / server-side projects. So I'm a bit of a novice when it
comes to designing Swing-based applications.

I'm now having to do more and more GUI work to support my current
projects, so I started looking for tutorial / best-practices materials
on the net. I was somewhat surprised to find that there's a dearth of
this sort of information. A quick Google search of 'swing best
practices' comes up with a couple of books and a few sites that
generally just re-iterate the APIs.

What I'm looking for are some Swing design best-practices akin to the
ones that are readily available for plain OO, J2EE design, etc.

Are there any?

For example:
- what's the best way to implement a wizard?
- how to minimise dependencies in a complex GUI?
- etc

Any pointers to useful books, sites, articles, example apps, etc.
appreciated.

- sarge
Jul 17 '05 #1
5 13947
sa*********@hotmail.com (Chris) wrote in message news:<56**************************@posting.google. com>...
[snipped...]
What I'm looking for are some Swing design best-practices akin to the
ones that are readily available for plain OO, J2EE design, etc.
What you have to understand is that Object Orientation and Enterprise
computing are both 'methodologies', to varying degrees, as well as just
technologies.

Swing is just a tool for writing UI software - it isn't a different
way of structuring and designing software in itself. As such, while
there are plenty of books and on-line resources devoted to how to
create good user interfaces (HCI, etc) I suspect there is little on
how to structure their design from a source code viewpoint (little
which is specific to UI coding anyway!)
Are there any?

For example:
- what's the best way to implement a wizard?
I suspect CardLayout would fit the job.
- how to minimise dependencies in a complex GUI?
You mean from a HCI viewpoint (ie. designing elegant interfaces) or
from a coding point of view? The issues surrounding compartmental-
ising and re-using Swing code are probably identical to handling any
other complex structures. You might want to take a look at the way
UI components work as Java Beans, as this offers a formalised way of
linking components together. Also take a look at the 'model'
interfaces which are used to connect Swing components to 'outside'
data structures.
- etc

Any pointers to useful books, sites, articles, example apps, etc.
appreciated.


Its not entirely clear whether you want a guide to good interface
design, a "How to...?" on creating user interfaces (like a Wizard)
or some sort of design methodology specific to writing GUI code...
-FISH- ><>
Jul 17 '05 #2
Perhaps I didn't make my point very clear.

What I'm after are some design patterns for writing Swing code.

As an analogy: you can look at the Java APIs or Java in a Nutshell,
but it doesn't tell you how to minimise inter-dependencies between
classes and avoid exposing implementation details using
getters/setters - for that you'd use the Builder pattern.

Similarly, I can look at the Swing APIs or examples on java.sun.com,
but they don't tell me how to use those components effectively, i.e. I
KNOW how to use a JTabbedPane in isolation for example, what I'm less
clear on is the BEST way to use it in the context of a large, complex
GUI.

If the examples of code I've seen of large applications are the norm
then I think I'll not bother, because they were basically
unmaintainable spaghetti, harking back to the dark days of MFC/C++
that I mentioned. I'm sure there must be better design idioms
relating specifically to Swing (or any event-based Windows-style API)
that promote good OO principles.

So, where are those sites that allow me to short-circuit my knowledge
of how to design GOOD Swing apps? Or does anyone know/have any
examples of well-designed (in their opinion) large-ish Swing apps?

- sarge
Jul 17 '05 #3

You can refer Swing Second Edition, by Matthew Robinson and Pavel vorobiev.

http://www.manning.com/robinson2/index.html

Thanks,
Sameer

Chris wrote:
Perhaps I didn't make my point very clear.

What I'm after are some design patterns for writing Swing code.

As an analogy: you can look at the Java APIs or Java in a Nutshell,
but it doesn't tell you how to minimise inter-dependencies between
classes and avoid exposing implementation details using
getters/setters - for that you'd use the Builder pattern.

Similarly, I can look at the Swing APIs or examples on java.sun.com,
but they don't tell me how to use those components effectively, i.e. I
KNOW how to use a JTabbedPane in isolation for example, what I'm less
clear on is the BEST way to use it in the context of a large, complex
GUI.

If the examples of code I've seen of large applications are the norm
then I think I'll not bother, because they were basically
unmaintainable spaghetti, harking back to the dark days of MFC/C++
that I mentioned. I'm sure there must be better design idioms
relating specifically to Swing (or any event-based Windows-style API)
that promote good OO principles.

So, where are those sites that allow me to short-circuit my knowledge
of how to design GOOD Swing apps? Or does anyone know/have any
examples of well-designed (in their opinion) large-ish Swing apps?

- sarge


~ Let us linux ~
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 17 '05 #4
>
Any pointers to useful books, sites, articles, example apps, etc.
appreciated.

A useful book for you could be
Graphic Java: Mastering the JFC (Swing), Volume II
Prentice Hall

When I started in Java GUI development, I found the most and best
informations in this comp.lang.java.* groups.

Klaus
Jul 17 '05 #5
Here are a bunch of points regarding Swing coding :
http://www.javapractices.com/TableOfContents.cjp#Swing

The site also has an example Swing app :
http://www.javapractices.com/Topic170.cjp
(The source is available for a small fee)

Chris wrote:
Having been traumatised many years ago when using MFC/C++ to develop
front-end code, I've religiously avoided GUI work since and stuck to
back-end / server-side projects. So I'm a bit of a novice when it
comes to designing Swing-based applications.

I'm now having to do more and more GUI work to support my current
projects, so I started looking for tutorial / best-practices materials
on the net. I was somewhat surprised to find that there's a dearth of
this sort of information. A quick Google search of 'swing best
practices' comes up with a couple of books and a few sites that
generally just re-iterate the APIs.

What I'm looking for are some Swing design best-practices akin to the
ones that are readily available for plain OO, J2EE design, etc.

Are there any?

For example:
- what's the best way to implement a wizard?
- how to minimise dependencies in a complex GUI?
- etc

Any pointers to useful books, sites, articles, example apps, etc.
appreciated.

- sarge


Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Don Vaillancourt | last post by:
Hello all, Over the years as I design more database schemas the more I come up with patterns in database design. The more patterns I recognize the more I want to try to design some kind of...
1
by: Jay | last post by:
The GOF text is widely considered the definitive book on the topic. Design Patterns: Elements of Reusable Object-Oriented Softare, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides ...
1
by: Josh28 | last post by:
Hi We are a group of two chaps just out of undergrad, we created a software to automate the use of Design Patterns. We have put it up at Source Forge--http://dpatoolkit.sourceforge.net/ The...
13
by: John Salerno | last post by:
Here are a few I'm considering: Design Patterns Explained : A New Perspective on Object-Oriented Design (2nd Edition) (Software Patterns Series) by Alan Shalloway Design Patterns C# by...
2
by: Carlo Stonebanks | last post by:
I have the infamous GoF Design Patterns boo - it's been sittin gon my shelf for years. I have a huge reading list and find this book a rather dry read and am always putting it off. I have...
22
by: Krivenok Dmitry | last post by:
Hello All! I am trying to implement my own Design Patterns Library. I have read the following documentation about Observer Pattern: 1) Design Patterns by GoF Classic description of Observer....
7
by: =?Utf-8?B?bWF2cmlja18xMDE=?= | last post by:
Hi, I would like to know more about design patterns and specifically using C#. Can any one recommend a good book? Thanks
10
by: vital | last post by:
Hi, I am designing the middle tier of a project. It has 6 classes and microsoft application data access block. The six classes are DBServices, Logger, ProjectServices ... etc. and all these...
6
by: r035198x | last post by:
I have put together this article to give people starting Swing an awareness of issues that need to be considered when creating a Swing application. Most of the Swing tutorials that I have seen just...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.