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

JTextfield does not visually indicate its editable state under Nimbus L&F

XMLWordPrintable

      OPERATING SYSTEMS:
      All

      FULL JDK VERSION:
      java version "1.6.0_12"
      Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
      Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode)

      DESCRIPTION:
      Create a sample Swing app with 2 JTextFields. Set one as editable and the other as non editable, and run this using Nimbus L&F. Both of them are visually indistinguishable from each other.

      Example code:

      import java.awt.BorderLayout;
      import java.awt.Container;
      import javax.swing.JFrame;
      import javax.swing.JTextField;
      import javax.swing.SwingUtilities;

      public class TextFieldTest extends JFrame {
      private JTextField editable = new JTextField("editable");
      private JTextField noneditable = new JTextField("uneditable");
      public TextFieldTest() {
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      Container pane = getContentPane();
      noneditable.setEditable(false);
      pane.setLayout(new BorderLayout());
      pane.add(editable,BorderLayout.NORTH);
      pane.add(noneditable,BorderLayout.CENTER);
      pack();
      setLocationByPlatform(true);
      setVisible(true);
      }

      public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable() {
      public void run() {
      new TextFieldTest();
      }
      });
      }
      }

            peterz Peter Zhelezniakov
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: