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

Metal LF JInternalFrame isn't updating size of iconified to match title

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.0
    • client-libs
    • beta
    • generic
    • generic



      Name: krC82822 Date: 04/30/2000


      30 Apr 2000, eval1127@eng -- unfortunately, contrary to the previous evaluation (under kestrel-rc2), this problem DOES appear to exist,
      even in kestrel-rc3 and 1.3.0-C (on both win32 and Solaris). I'm not sure how I managed to make it work. (Perhaps I slightly
      permuted the order of steps-to-reproduce).

      Anyway, this IS, unfortunately, a bug. (see also 4131008, 4134077)

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

      15 Mar 2000, eval1127@eng -- a validate/revalidate after the title change works fine (at least on kestrel-rc2).
      (see also 4130825)

            iframe.addMouseListener(new MouseAdapter() {
               public void mouseClicked(MouseEvent e) {
                  String s = JOptionPane.showInputDialog(iframe, "New title :");
                  if (s != null) {
                     iframe.setTitle(s);
                     iframe.revalidate(); // <<<<-----
                  }
               }}
            );

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

      java version "1.3.0rc1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
      Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)

      The size of an iconified JInternalFrame isn't being set based on the current
      title text. It appears to be set once, the very first time the frame is
      iconified. This is very inefficient, wasting a lot of space, for the cases where
      the title text gets changed during the course of a session(like in my app).

      The following test app can be used to see the problem. After invoking iconify
      both internal frames. This will set the width of the iconified "bar". Now open
      the one with the longer title and click anywhere on the interior of the frame to
      open an input dialog. Change the title text to be something really short, like
      "Hi". Now minimize the frame again. Notice how the iconified "bar" is still
      really wide, when it _should_ have been resized to match the title text?

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

      public class JDesktopPanePaintBug extends JFrame {
         public static void main(String[] args) {
            new JDesktopPanePaintBug();
         }

         public JDesktopPanePaintBug() {
            addWindowListener(new WindowAdapter() {
               public void windowClosing(WindowEvent e) {
                  System.exit(0);
               }}
            );

            JDesktopPane desktop = new JDesktopPane();
            setContentPane(desktop);

            final JInternalFrame iframe = new JInternalFrame("This is a test frame
      with a long title", true, false, true, true);
            iframe.setOpaque(true);
            iframe.setBackground(Color.white);
            iframe.setBounds(10,10,200,200);
            iframe.setVisible(true);
            iframe.addMouseListener(new MouseAdapter() {
               public void mouseClicked(MouseEvent e) {
                  String s = JOptionPane.showInputDialog(iframe, "New title :");
                  if (s != null) {
                     iframe.setTitle(s);
                  }
               }}
            );
            desktop.add(iframe);

            JInternalFrame iframe2 = new JInternalFrame("Hello", true, false, true,
      true);
            iframe2.setOpaque(true);
            iframe2.setBackground(Color.gray);
            iframe2.setBounds(250,10,200,200);
            iframe2.setVisible(true);
            desktop.add(iframe2);

            pack();
            setBounds(300, 300, 500, 300);
            setVisible(true);
         }
      }

      ---------

      4/19/2000 user notes (and apparently had previously, in earlier mail) that the workaround
      does NOT work for him, even with 1.3 RC3. It worked fine here on a uniprocessor
      machine (user has only multi-processor machines).
      (Review ID: 102449)
      ======================================================================

            joutwatesunw Joshua Outwater (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: