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

border.TitledBorder.paintBorder() throws NPE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P3 P3
    • None
    • 1.4.0
    • client-libs



      Name: asR10047 Date: 12/19/2000



      Below is a small example that demonstrates how NPE is raising from
      TitledBorder.paintBorder()

      -------------------------------------------------
      import java.awt.*;
      import javax.swing.*;
      import javax.swing.border.*;


      public class BorderTest {

          public static void main(String[] argv) {
              String title = "Test";
              JButton component = new JButton("Test");
              TitledBorder border;
              JFrame f = new JFrame("Test Frame");
              f.setBounds(100, 100, 100, 100);
              f.setVisible(true);
              Graphics g = f.getGraphics();
              border = new TitledBorder( title);
              border.paintBorder(component, g, 0, 1, 2, 3);
              f.dispose();
          }
      }
      -------------------------------------------------
      The following is throwing from the test:

      (ans@matmech(pts/10): ~/work .220)
      :\>/net/sword/export3/JDK1.4.0beta-b45/solaris/bin/java BorderTest
      Exception in thread "main" java.lang.NullPointerException
              at java.awt.Rectangle.setBounds(Rectangle.java:254)
              at javax.swing.border.TitledBorder.paintBorder(TitledBorder.java:333)
              at BorderTest.main(BorderTest.java:17)


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

            amfowler Anne Fowler (Inactive)
            anssunw Ans Ans (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: