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

Panels draw incorrectly when given an inset

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1.8
    • CPU:
      x86
    • OS:
      windows_nt
    • Verification:
      Verified

      Backports

        Description



        Name: chT40241 Date: 12/21/98


        When the following code is run the provided panels will not paint completely. This worked just fine in java 1.1.7

        /* Copyright (c) 1998 by SAS Institute Inc., Cary, NC 27513 */
        public class test
        extends java.awt.Dialog
        implements java.awt.event.WindowListener
        {
        public static void main(String[] argv)
        {
        test t = new test(new java.awt.Frame(), "Test");
        t.setVisible(true);
        }

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

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

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

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

        // Defined in java.awt.event.WindowListener
        public void windowClosed( java.awt.event.WindowEvent p1)
        {
        }

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

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

        public test(java.awt.Frame f, String t)
        {
        super(f,t);

        setLayout (new java.awt.BorderLayout());
        //java.awt.Dimension dlgdm = getSize();
        //initText();

        InsetPanel a = new InsetPanel (5,5, 5, 10);
        add (a, "West");
        a = new InsetPanel(5,5,10,10); //t,b,l,r
        add (a, "Center");
        a = new InsetPanel (5,20, 10, 10);
        //m_forOk.setLayout (new java.awt.FlowLayout (java.awt.FlowLayout.RIGHT, 7, 0));
        add (a, "South");
        //pack();
        setSize (450, 290);
        //setLocation (new java.awt.Point (xPos, yPos));
        //invalidate();
        addWindowListener(this);
        }

        class InsetPanel
        extends java.awt.Panel
        {
        int b=-1;
        int t=-1;
        int r=-1;
        int l=-1;

        public InsetPanel (int ti, int bi, int li, int ri)
        {
        super();

        t = ti;
        b = bi;
        r = ri;
        l = li;
        }

        public java.awt.Insets getInsets()
        {
        java.awt.Insets myInsets = super.getInsets();
        if (b > -1)
        myInsets.bottom = b;
        if (t > -1)
        myInsets.top = t;
        if (r > -1)
        myInsets.right = r;
        if (l > -1)
        myInsets.left = l;
        //I.top = 10;
        //myInsets.right = 10;
        return myInsets;
        }

        }


        }

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

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                uwesunw Uwe Uwe (Inactive)
                Reporter:
                chickeysunw Chuck Hickey (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: