Roy Tang

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Notes Photos Links Archives About

All entries tagged applet.

You can subscribe to an RSS feed of this list.

Dec 2009

  • We’re working on a project with a number of applets that has to work across a large range of OS (WIndows, Mac, Linux), browsers (IE, FF, Safari, etc) and Java versions (1.5+), and it often happens that a fix we apply will cause some sort of security exception an another platform or some other error.

    Is there any way for us to prepare automated tests to immediately catch those problems in different platforms? I think it’s not necessary to check that the gui parts are appearing as intended, but just to detect whether unexpected exceptions are occuring.

  • We have a web screen with a number of applets that has a problem on Mac OSX 10.5.7, Firefox 3.0.15, java 1.5.0_19.

    The problem is encountered on the user site. On initial load of applets (with an empty applet cache), the screen locks up/hangs while loading the applets. After refreshing the page, it loads normally. If the cache is cleared, same problem happens again.

    Unfortunately, we’re not encountering this on our local test machine (same OS, java and Firefox versions)

    We were able to get a jstack thread dump, see below: http://pastebin.com/m527e05dd

    However, we’re not sure how to interpret it. Any suggestions or advice?

    Edit: We were able to replicate in our testing machine by creating a new user (clean Firefox profile). If we clear the java cache then visit the problematic pages, the edit controls are disabled (we can’t click them to focus them), the Firefox address bar and search box have the same behavior. The edit box controls only “unfreeze” when we access the “Help” menu entry, which has a Search edit box that is active.

Nov 2009

  • 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 {
            progressDialog.setLocationRelativeTo(null);
    
            // show the dialog
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    progressDialog.setVisible(true);
                }
            });
    
            // business logic code that calls progressDialog.setProgress along the way
            doStuff();
            
        } finally {
            progressDialog.setVisible(false);
            progressDialog.dispose();
        }
    }
    

    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() {
                    progressDialog.setVisible(true);
                }
            }.start();
    

    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