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

JLabel has shaggy text when disabled

    Details

      Description

      Name: yyT116575 Date: 06/19/2001


      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

      The bug is the same as 4203862.
      JLabel - disabled text paints edges backwards (s/b dark upper left/light lower
      right). It looks very wrong.

      The bug is marked Fixed but it still remains if the Look&Fell is set to Windows.
      Here goes the sample program that demonstrates the bug.

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

      public class Frame1 extends JFrame {
        JPanel contentPane;

        public Frame1() {
          enableEvents(AWTEvent.WINDOW_EVENT_MASK);
          contentPane = (JPanel) this.getContentPane();
          contentPane.setLayout(new GridLayout(2, 2));
          this.setSize(new Dimension(300, 100));

          FilledLabel label1 = new FilledLabel("testtestTESTTEST");
          label1.disable();
          FilledLabel label2 = new FilledLabel("testtestTESTTEST");

          getContentPane().add(label1);
          getContentPane().add(label2);
        }

        public static void main(String[] args) {
          try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
          } catch(Exception e) {
            e.printStackTrace();
          }
          Frame1 f = new Frame1();
          f.setVisible(true);
        }

        class FilledLabel extends JLabel {
          public FilledLabel(String title) {
            super(title);
          }

          public void paint(Graphics g) {
            g.setColor(Color.black);
            g.fillRect(getX(), getY(), getWidth(), getHeight());
            super.paint(g);
          }
        }
      }

      After running, the top label looks wrong. If the UIManager.setLookAndFeel() call
      is removed the problem disappears.
      (Review ID: 126893)
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              jmarinacsunw Joshua Marinacci (Inactive)
              Reporter:
              yyoungsunw Yung-ching Young (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: