File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Displaying errors in a GUI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Displaying errors in a GUI" Watch "Displaying errors in a GUI" New topic

Displaying errors in a GUI

Barry Brashear
Ranch Hand

Joined: Jun 05, 2001
Posts: 303
Does anyone have any ideas on how to display errors in a Swing GUI application if the user does not want to see dialogs?

Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1141

Use the "status bar"?
Barry Brashear
Ranch Hand

Joined: Jun 05, 2001
Posts: 303
What's that? Is that an error of the application designed for displaying
errors? Is there another application I can look at that uses something
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

Status bars aren't really designed for error messages. If you can't use dialogs then I would either use in line error messages using a simple JLabel. You can set the font so that it is red, etc. If you don't have room per say for in line error messages, then create a message header on your form of some sort that can display error messages above all the components. Really, it's not that different than displaying error messages in web pages, if you are familiar with that at all.

Take a look at the JGoodies Validation Demo. It will give you some good ideas. You may even want to use that package.

GenRocket - Experts at Building Test Data
Scott Delap
Ranch Hand

Joined: Apr 05, 2005
Posts: 73
I'll second JGoodies Validation. You can either display all validation errors in a summary component or change the components that have errors such as setting a text field background to red.
I agree. Here's the link:
subject: Displaying errors in a GUI
It's not a secret anymore!