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

java.awt.Choice moves incorrectly when in a container with a layout manager

XMLWordPrintable

    • rc3
    • x86
    • windows_nt



        Name: pa48320 Date: 03/22/2000


        When a Choice is placed in a container with a layout mananger and the container is moved or resized, the choice moves outside the container.
        Consider the following code. When the mouse is clicked in the frame, the choice moves down. It should have only moved right by 10 pixels.
        This is possibly a regression of 4130788 and is very important to us

        public class choiceTest
        extends java.awt.Frame
        implements java.awt.event.WindowListener, java.awt.event.MouseListener
        {
        public static void main(String[] args)
        {
        choiceTest t = new choiceTest("choiceTest");
        t.setSize(400,600);
        t.setLayout(null);
        java.awt.Container c = new java.awt.Container();
        t.add(c);
        c.setSize(200,200);
        c.setLocation(100,100);
        java.awt.Choice ch = new java.awt.Choice();
        c.setLayout(new java.awt.BorderLayout());
        ch.setSize(100,27);
        c.add(ch, "South");
        t.addWindowListener(t);
        t.addMouseListener(t);
        t.setVisible(true);
        }
        public choiceTest(String title)
        {
        super(title);
        }

        //Defined in java.awt.event.WindowListener
        public void windowOpened(java.awt.event.WindowEvent p0 )
        {
        }

        //Defined in java.awt.event.WindowListener
        public void windowClosing(java.awt.event.WindowEvent p0 )
        {
        dispose();
        }

        //Defined in java.awt.event.WindowListener
        public void windowClosed(java.awt.event.WindowEvent p0 )
        {
        System.exit(0);
        }

        //Defined in java.awt.event.WindowListener
        public void windowIconified(java.awt.event.WindowEvent p0 )
        {
        }

        //Defined in java.awt.event.WindowListener
        public void windowDeiconified(java.awt.event.WindowEvent p0 )
        {
        }

        //Defined in java.awt.event.WindowListener
        public void windowActivated(java.awt.event.WindowEvent p0 )
        {
        }

        //Defined in java.awt.event.WindowListener
        public void windowDeactivated(java.awt.event.WindowEvent p0 )
        {
        }

        //Defined in java.awt.event.MouseListener
        public void mouseClicked(java.awt.event.MouseEvent p0 )
        {
        }

        //Defined in java.awt.event.MouseListener
        public void mousePressed(java.awt.event.MouseEvent p0 )
        {
        java.awt.Component c = getComponent(0);
        c.setLocation(110,100);
        }

        //Defined in java.awt.event.MouseListener
        public void mouseReleased(java.awt.event.MouseEvent p0 )
        {
        }

        //Defined in java.awt.event.MouseListener
        public void mouseEntered(java.awt.event.MouseEvent p0 )
        {
        }

        //Defined in java.awt.event.MouseListener
        public void mouseExited(java.awt.event.MouseEvent p0 )
        {
        }

        }

        (Review ID: 102741)

        ======================================================================

              bchristi Brent Christian
              pallenba Peter Allenbach (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: