jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes Displaying error on an Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Displaying error on an Applet " Watch "Displaying error on an Applet " New topic

Displaying error on an Applet

Nadda Habba

Joined: Feb 16, 2005
Posts: 18

I have created an applet for a login screen. I have validation methods in my applet. I need to display errors within the applet for failed validations. how do i do it ? in jsp i can use out.println() function but am unaware how to achieve the same in an applet.

any suggestions ?

thanks in advance

Pete Tibbster

Joined: Aug 29, 2004
Posts: 11
you could...
1. You could write the error to the console log. Use System.out.println(error) to write an entry to the java plugin console.
2. You could create a JLabel, add it to your screen and set the text to the error message to display the error back to the user.
Joe Ess

Joined: Oct 29, 2001
Posts: 9189

You could use AppletContext.showStatus(String status) to display a message in the status window at the bottom of the browser, but your users are likely to miss it.
You could pop up a dialog window, but you can't make dialogs modal in an applet (a modal dialog remains on top of the app and blocks input so the user has to respond to it)
I prefer to display a dialog within the applet, but block input to it. You can do this by displaying an "internal dialog" with one of the JOptionPane.showInternal*Dialog() methods and by adding a MouseListener to a JApplet's glassPane to block all other input.
[ February 28, 2005: Message edited by: Joe Ess ]

[How To Ask Questions On JavaRanch]
I agree. Here's the link: http://aspose.com/file-tools
subject: Displaying error on an Applet
jQuery in Action, 3rd edition