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

Multiple COMPONENT_RESIZED events delivered on programmatic resize (1.1.x only)

    XMLWordPrintable

Details

    • sparc
    • solaris_2.5.1, solaris_7

    Description

      MULTIPLE COMPONENT_RESIZED EVENTS DELIVERED

      On Motif and Windows, two COMPONENT_RESIZED events are generated
      for programmatic change(using setSize()), and one COMPONENT_RESIZE
      event is generated for a manual change.
      .
      Also, on Windows, setVisible(true) on Frame deliver COMPONENT_RESIZE
      and a COMPONENT_SHOWN events. Whereas, on Motif only COMPONENT_SHOWN
      is delivered. This is noticed right in the beginning when the Frame
      is shown.
      .
      Here is the test case for reproducing the problem:
      *******************************************************************
      import java.applet.*;
      import java.awt.*;
      import java.awt.event.*;
      public class FrameItem
             extends Applet
             implements ActionListener, ComponentListener
      {
          Frame mFrame;
          Button mButton;
          Button mFrameButton;
          public FrameItem()
          {
          }
          public void start()
          {
              mButton = new Button("Resize 300x300");
              mButton.addActionListener(this);
              Panel panel = new Panel();
              panel.setLayout(new FlowLayout(FlowLayout.CENTER, 30, 30));
              panel.add(mButton);
              add(panel);
              mFrameButton = new Button("Resize 600x300");
              mFrameButton.addActionListener(this);
              Panel framePanel = new Panel();
              framePanel.setLayout(new FlowLayout(FlowLayout.CENTER, 30, 30));
              framePanel.add(mFrameButton);
              mFrame = new Frame("Frame Events");
              mFrame.add("South", framePanel);
              mFrame.setSize(400, 200);
              mFrame.addComponentListener(this);
              mFrame.setVisible(true);
          }
          public void actionPerformed(ActionEvent event)
          {
              System.out.println("ActionEvent: " + event);
              if ( event.getSource() == mButton )
              {
                  mFrame.setSize(300, 300);
              }
              else if ( event.getSource() == mFrameButton )
              {
                  mFrame.setSize(600, 300);
              }
          }
          public void componentResized(ComponentEvent e)
          {
              System.out.println("ComponentEvent: " + e);
          }
          public void componentMoved(ComponentEvent e)
          {
          }
          public void componentHidden(ComponentEvent e)
          {
          }
          public void componentShown(ComponentEvent e)
          {
              System.out.println("ComponentEvent: " + e);
          }
      }
      @ Problem does still occur under Solaris.

      Attachments

        Activity

          People

            ibdsunw Ibd Ibd (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: