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

unable to set the JRadioButton disabledText for Motif L&F

    Details

      Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      I have been unable to set the default color for disabled text in the JRadioButton. I have tried RadioButton.disabledText and RadioButton.disabledForeground to no avail.
      There was a bug report submitted (#4314194 ) against a similar problem but only the Metal L&F was addressed. It says in the report that the problem has been fixed for 1.4(merlin-beta) but in 1.5 I am still seeing problems in the Motif L&F. The workaround mentioned in the bug report does work.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      (1) set your look and feel:
       UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");

      (2) try to set your RadioButton disabled text default:
          defaults.put ("RadioButton.foreground", Color.white);
          defaults.put ("RadioButton.background", Color.black);
          defaults.put ("RadioButton.disabledText", Color.gray);

      (3) create a radio button and disable it and the color will not be gray, it will be black

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      expected color of disabled text to be gray
      ACTUAL -
      color of disabled text was black (darker shade of background color)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import java.awt.Color;

      public class swingTest {

      private static void createFrame() {
      try
      {
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); UIDefaults defaults = UIManager.getLookAndFeelDefaults();
      defaults.put ("RadioButton.foreground", Color.white);
      defaults.put ("RadioButton.background", Color.black);
      defaults.put ("RadioButton.disabledText", Color.gray);
      }
      catch (Exception e) { System.out.println(e); }

              JFrame frame = new JFrame("Test Swing Application");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

              JLabel label = new JLabel("Hello World");
      JRadioButton rButton1 = new JRadioButton("Test RadioButton");
              frame.getContentPane().add(label);
              frame.getContentPane().add(rButton1);
      rButton1.setEnabled(false);
      frame.pack();
              frame.setVisible(true);
          }

          public static void main(String[] args) {
      createFrame();
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      see:
      http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4314194
      ###@###.### 2005-07-04 12:08:26 GMT
      ###@###.### 2005-07-04 12:09:45 GMT

        Attachments

          Activity

            People

            • Assignee:
              shickeysunw Shannon Hickey (Inactive)
              Reporter:
              ndcosta Nelson Dcosta
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: