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

Insets does not layout a component correctly

XMLWordPrintable

    • x86
    • windows_95

      With JDK1.2_beta1 and Swing-0.5.1, the left inset was ignored when rendering a component in a container. For example,

      The left inset was 30 but LocationPanel didn't layout panel as it is.
      The top, bottom, and right insets were fine.
      Here is the test case:

      //
      // Test Case By Kim Bae-Chul
      //

      import java.awt.*;
      import java.io.*;
      import java.util.*;
      import java.awt.event.*;
      import com.sun.java.swing.*;
      import com.sun.java.swing.border.*;


      public class Test extends JFrame
      {
          public Test(){
              super("Test Suite");
              setBackground(Color.lightGray);

              JPanel panel = new JPanel();
              panel.setBorder(new EmptyBorder(new Insets(30,30,30,30)));
              panel.add(new JButton("Test Button"));

              add(panel);
      pack();
              show();

              Insets insets = panel.getInsets();
              System.out.println("Top: "+insets.top);
              System.out.println("Left: "+insets.left);
              System.out.println("Bottom: "+insets.bottom);
              System.out.println("Right: "+insets.right);
          }

          public static void main(String args[]){
              Test frame = new Test();
          }
      }


            rramsunw Ranganathan Ram (Inactive)
            bkimsunw Bae-chul Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: