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

border property fails on JLabel

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2
    • 1.1.5
    • 1.1.4, 1.2.0
    • client-libs
    • None
    • 1.1.5
    • unknown, x86
    • solaris_2.5.1, windows_nt
    • Not verified

    Description

      From: "Ganyo, Scott" <###@###.###>
      To: "'SwingSet Feedback'" <###@###.###>
      Subject: Bug: Borders around JLabel
      Date: Tue, 4 Nov 1997 14:58:14 -0500

      When I add a border (I tried the BevelBorder) to a JLabel, the preferred
      size doesn't appear to take into account the border insets. Thus, I get
      a label that is not tall enough and not long enough to hold the text on
      the label.

      Scott Ganyo
      Interactive Intelligence, Inc.
      3500 DePauw Blvd., Suite 1060
      Indianapolis, IN 46268
      317.872.3000 x157
      http://www.inter-intelli.com


      The application below demonstrates the problem:


      /* setenv JDKHOME /home/hmuller/ws/jdk12/build/solaris
       * ${JDKHOME}/bin/javac -classpath ${JDKHOME}/classes JListBorder.java
       * ${JDKHOME}/bin/java -classpath .:${JDKHOME}/classes JListBorder
       */

      import java.awt.*;
      import java.awt.event.*;
      import java.awt.swing.*;
      import java.awt.swing.event.*;
      import java.awt.swing.border.*;


      /**
       * Create a JList with a big red border. As of Swing0.6, the border
       * obscures the label text.
       */
      public class JLabelBorder
      {
          public static void main(String[] args)
          {
      JLabel label = new JLabel("Hello World");
      label.setBorder(new LineBorder(Color.red, 10));

      WindowListener l = new WindowAdapter() {
      public void windowClosing(WindowEvent e) {System.exit(0);}
      };
      JFrame f = new JFrame("JListBorder");
      f.addWindowListener(l);
      f.getContentPane().add(label);
      f.pack();
      f.show();
          }
      }



      Attachments

        Issue Links

          Activity

            People

              sswingtrsunw Swingtraq Swingtraq (Inactive)
              sswingtrsunw Swingtraq Swingtraq (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: