Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6301781

REGRESSION: Unable to resize a JWindow on Solaris with JRE 1.5

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_10

      Description

      FULL PRODUCT VERSION :
      java version "1.5.0_04"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05) Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode)

      java version "1.5.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08) Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)



      ADDITIONAL OS VERSION INFORMATION :
      SunOS ux159-sol10 5.10 s10_72 sun4u sparc SUNW,Sun-Fire-V440
      SunOS sjoqa10-sol10 5.10 Generic i86pc i386 i86pc


      A DESCRIPTION OF THE PROBLEM :
      When a JWindow is created, the size can never be changed.

      This is not a problem on MS Windows, or on Solaris with java 1.4.2, but on Solaris (both x86 and SPARC) with java 1.5, it is a problem. I reproduce the problem with 1.5.0_01 and 1.5.0_04 on x86 Solaris 10, and 1.5.0_01 on SPARC Solaris 10. The problem does NOT occur with 1.4.2_06 on x86 Solaris 10.




      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Test case:
      Compile and run the program provided in "Source Code" below, jwindowbug.JWindowBug. You'll get a small frame with a button that says "Open JWindow". Clicking the button brings up a JWindow on top of the frame. Every second, the JWindow's size will be changed, so you should see the window growing and then shrinking back to the original size. After 20 seconds, the JWindow will close.

      On Windows with JRE 1.4 or 1.5,, or on Solaris with a 1.4 VM, this works fine. On Solaris with a 1.5 VM, the JWindow never changes size.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The JWindow should change once per second for 20 seconds, then close. This is what happens on Windows or with JRE 1.4 on Solaris.
      ACTUAL -
      The JWindow never changes size. The size it is when it is created is the size it stays.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      --------------- BEGIN jwindow/JWindowBug.java ---------------------
      package jwindowbug;

      import java.awt.BorderLayout;
      import java.awt.Color;
      import java.awt.Container;
      import java.awt.Frame;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;

      import javax.swing.BorderFactory;
      import javax.swing.JButton;
      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.JTextArea;
      import javax.swing.JWindow;
      import javax.swing.SwingUtilities;

      public class JWindowBug
      {

      public JWindowBug()
      {
      super();
      JFrame frame = new JFrame("JWindowBug Tester");
      Container contentPane = frame.getContentPane();
      contentPane.setLayout(new BorderLayout());

      JButton button = new JButton("Open JWindow");
      contentPane.add(button, BorderLayout.NORTH);
      button.addActionListener(new _ActionListener(frame));

      frame.setBounds(100, 100, 200, 200);

      frame.show();
      }

      private class _ActionListener implements ActionListener
      {
      private final Frame _parent;

      public _ActionListener(Frame parent)
      {
      _parent = parent;
      }

      public void actionPerformed(ActionEvent e)
      {
      JWindow window = new JWindow(_parent);
      Container contentPane = window.getContentPane();

      JPanel panel = new JPanel();
      contentPane.setLayout(new BorderLayout());
      contentPane.add(panel, BorderLayout.CENTER);
      panel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
      panel.setLayout(new BorderLayout());

      JTextArea tarea = new JTextArea();
      panel.add(tarea, BorderLayout.CENTER);
      window.setBounds(100, 100, 200, 200);
      window.show();
      new Thread(new _WindowShaker(window, tarea)).start();
      }
      }

      private class _WindowShaker implements Runnable
      {
      private final JWindow _window;
      private final JTextArea _tarea;

      private int i = 0;

      public _WindowShaker(JWindow window, JTextArea tarea)
      {
      _window = window;
      _tarea = tarea;
      }

      private void _shakeWindow()
      {
      int size = ((i % 3) + 2) * 100;

      _window.setSize(size, size);
      _tarea.setText("Shake count: " + i + "\nSize: " + size);
      _window.validate();
      }

      public synchronized void run()
      {
      try {
      for (i = 0; i < 20; i++) {
      Thread.sleep(1000);
      SwingUtilities.invokeLater(new Runnable() {
      public void run() {
      _shakeWindow();
      }
      });
      }
      }
      catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace(System.err);
      }
      finally {
      _window.hide();
      }
      }
      }

      public static void main(String[] args)
      {
      JWindowBug tester = new JWindowBug();
      }
      }

      --------------- END jwindow/JWindowBug.java ------------------------
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      I haven't found one yet.

      Release Regression From : 1.4.2
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

        Attachments

          Activity

            People

            • Assignee:
              vbaranovsunw Vyacheslav Baranov (Inactive)
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: