-
Bug
-
Resolution: Won't Fix
-
P5
-
5.0
-
x86
-
windows_xp
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
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