Posts Photos Archives About

Subscribe: RSS JSON

2009 December

2009 November

  • Applets failing to load

    While testing our setup for user acceptance testing, we got some reports that java applets in our web application would occasionally fail to load. The envt where it was reported was WinXP/IE6, and there were no errors found in the java console.

    Obviously we'd like to avoid it. What sort of things should we be checking for here? On our local servers, everything seems fine. There's some turnaround time when sending questions to the on-site guy, so I'd look to cover as many possible causes as possible.

    Some more info: We have multiple applets, in the instance that they fail loading, all of them fail loading. The applet jar files vary in size from 2MB to 8MB. I'm told it seems more likely to happen if the applet isn't cached yet, i.e. if they've been able to load the applets once on a given machine, further runs on that machine go smoothly. I'm wondering if there's some sort of network transfer error when downloading the applets, but I don't know how to verify that.

    Any advise is welcome!

  • We have an Applet that can possibly display Chinese text. We are specifying a font for it (Arial), it works fine under both Windows and Mac OSX.

    But in Firefox on Linux the Chinese characters are rendered as squares. Is there a way to work around this? Note that we can't assume the existence of a particular font file on the client.

  • I have an applet that calls a JDialog that contains a JProgressBar component. I subclass the JDialog to expose a method to update the JProgressBar, something like:

    public class ProgressDialog extends javax.swing.JDialog {
        public void setProgress(double progress) {
            jProgressBar1.setValue(jProgressBar1.getMinimum() + (int) (progress * jProgressBar1.getMaximum()));

    I use this dialog in the following manner:

    public void test() throws Exception {
        progressDialog = new ProgressDialog(null, true);
        try {
            // show the dialog
            EventQueue.invokeLater(new Runnable() {
                public void run() {
            // business logic code that calls progressDialog.setProgress along the way
        } finally {

    It works fine on Windows/any browser. However, when invoking the above function on Firefox 2/3/3.5 on a Mac, the progressDialog is displayed indefinitely, i.e. it doesn't close.

    I suspected that calling setVisible(true) inside the EventQueue was causing the problem, since it's a blocking call and might block the queue completely, so I tried changing it to:

            // show the dialog
            new Thread() {
                public void run() {

    With this change, the progressDialog now closes correctly, but a new problem emerged - the contents of the dialog (which included the progressbar, an icon and a JLabel used to show a message string) were no longer shown inside the dialog. It was still a problem only on Mac Firefox.

    Any ideas? I realize it's probably some AWT threading issue, but I've been at this for a couple of days and can't find a good solution. Wrapping the doStuff() business logic in a separate new Thread seems to work, but it's not easy to refactor the actual business logic code into a separate thread, so I'm hoping there's a simpler solution.

    The envt is: Mac OSX 10.5 Java 1.5 Firefox 2/3/3.5