bug in jdk1.4

Bjorn Dittmer-Roche bjorn at sccs.swarthmore.edu
Thu Feb 26 12:42:24 PST 2004


Hey all,

	I'm pretty sure this is a bug in FreeBSD's java implementation,
but I suppose it could be a problem almost anywhere. Basically, when you
run the program below, the JDialog (JOptionPane) appears *behind* the
JWindow instead of in front of it, unless the JWindow has keyboard focus.
This is very bad if the window is bigger than the dialog as it obscures
the dialog box. Linux does not exibit this behaviour. It can be worked
around using an undecorated JFrame, which is what I'm doing in my big
application, but that's not compatible with java 1.3, and it's not
necessary on other platforms.

Here's what I'm using:

twiggy:~> uname -a
FreeBSD twiggy 4.9-STABLE FreeBSD 4.9-STABLE #2: Wed Jan 14 17:21:22 EST
2004     root at twiggy:/usr/obj/usr/src/sys/TWIGGY  i386
twiggy:~> java -version
java version "1.4.2-p6"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.4.2-p6-root_23_feb_2004_13_28)
Java HotSpot(TM) Client VM (build 1.4.2-p6-root_23_feb_2004_13_28, mixed
mode)

I am also using KDE with "focus strictly under mouse".

Sun won't accept the bug report because it's not for linux, solaris or
windows.

Let me know what I can do.

thanks,

	bjorn

-------------------------


import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public final class BuggyWindow2 extends JWindow implements Runnable
{
   JTextField jtf;
   JTextArea jta;

   public static void main( String args[] )
   {
      BuggyWindow2 bw2;
      (bw2 = new BuggyWindow2()).show();
      try { Thread.sleep(1000); } catch (InterruptedException ie) {}
      SwingUtilities.invokeLater( bw2 );
   }
   public BuggyWindow2()
   {
      //setUndecorated( true );
      getContentPane().add( new JLabel( "Hello" ) );
      pack();
   }
   public void run()
   {
      JOptionPane.showMessageDialog( this, "This should be on top",
            "This should be on top", JOptionPane.PLAIN_MESSAGE );
   }
}


More information about the freebsd-java mailing list