Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing Application Design  RSS feed

 
Steve Mitchell
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know a good example or open source Swing application? I've had my head in Web development the last 7 years. It looks like Card Layout might be a good approach, or perhaps changing out panels on a master frame as the user makes selections, but I would like to see a high-quality multiple screen application in action before I start mine. I'm use to using Struts where your basic choice is a redirect or a forward. In that world you don't have to write/manage the application's container.

Thanks!
 
Thomas Hubschman
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I did my first big Swing app last year. I ended up using many many layouts all inside one big GridBagLayout. Also I used a clearly separated controller that handled all events from the GUI. It was a very complicated app, but worked well when it was done. Unfortunately, I cannot send you the code for it. I can tell you that Swing has a steep learning curve, but when you get on top of it, it's pretty powerful.

It's hard to offer advice without knowing a little more about your application. Send along some more details!

Tom
 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use XYLayout(in the JBuilder) when I create a unresizeable dialog.It works well.Why it not metioned here?It has some faults?
 
Steve Mitchell
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not a production application. I'm teaching a Java course for a local company. We're in the middle of a two week section on Swing. I want to build a more "real world" lab than what was included in the materials. I had the students write a simple student enrollment application in the Java Fundamentals section that has a layered archicture and a command prompt UI. It has student CRUD, course CRUD, and enrollment CRUD. I will have them add a Web front-end to that application when we get to JSPs. This week I want them to add a Swing front end, but I want to show them a real-world approach. Since I only do Web applications professionally, I have to look beyond my work experience for examples.

I saw one post argue against switching out panels in a single frame (which I drawn to since it is like switching out web pages in a browser). They recommended Card layout, which will work for this simple lab, but it got me curious how a large application with many sub-systems might be done. I could picture a combination of the two approaches where you might switch out card "stacks" in a single frame as they moved between sub systems.

In any case, I don't want to guess as to how a complex application might be done. I would love to point them to a real example.

Any thoughts?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve, I think it kind of depends on the goal of the 2 week section. Is the goal to teach them the basics of Swing or how to write a production level swing application? While I am in favor of both, 2 weeks just isn't enough time. Swing is a monster and must be tackled in steps.

Layouts tend to cause a lot of frustration with new Swing developers. So instead of trying to wrap their heads around using layouts jumping from form to form, I would concentrate the layout discussion to the layout of the components on each form. Make moving from form to form as easy as possible. The easiest solution is to use a JTabbedPane and have a form on each tab. If you wanted to do something a little more fun, use a JDesktopPane and have each form in it's own JInternalFrame (MDI).

The problem with swing is there are thousands of ways to do hundreds of things.
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you can, grab JGoodies forms for the layout manager. It really makes doing the layout very easy and can allow you to get into more of the Swing components (if that is your goal).
 
Steve Mitchell
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg,

Good point. I will follow the KISS principle for class. I never found a good point to start on Google. I was Googling for Swing framework, Swing design, and Swing patterns. Most of what I saw was at the container, component, layout manager, and look and feel level. I hope that if I ever find myself on a production Swing project I have some experienced Swing developers to lean on !

Thanks,
Steve
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!