Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #4991
| From | "John B. Matthews" <nospam@nospam.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: JDateChooser setEnabled Color |
| Date | 2011-06-05 13:29 -0400 |
| Organization | The Wasteland |
| Message-ID | <nospam-DF21D0.13292205062011@news.aioe.org> (permalink) |
| References | <543b5b7c-b7f7-4445-91fb-8f65391a8c68@n11g2000yqf.googlegroups.com> |
In article
<543b5b7c-b7f7-4445-91fb-8f65391a8c68@n11g2000yqf.googlegroups.com>,
Biagio <software@notario.it> wrote:
> I'm using the powerfull JDateChooser JCalendar library 1.3.3.
I assume you mean com.toedter.calendar.JDateChooser, found here:
<http://www.toedter.com/en/jcalendar/>
> Unfortunately, when the component is setEnabled (false) the color of
> date is a gray almost unreadable.
The color has nothing to do with JDateChooser; it is specified by the
user interface default, which varies for each look and feel.
> I tried to change color, but when the component is disabled is not
> possibile, it is always gray.
>
> I would like to get a look like JTextField.setEditable (false).
>
> Does anyone have any suggestions?
Because JDateChooser has a com.toedter.calendar.JTextFieldDateEditor, a
subclass of javax.swing.JFormattedTextField, you can set the disabled
color of any particular instance:
JDateChooser jdc = new JDateChooser();
jdc.setEnabled(false);
((JTextFieldDateEditor)jdc.getDateEditor())
.setDisabledTextColor(Color.darkGray);
Alternatively, you can change the UI manager's default, but I'd be wary
of veering too far from the familiar interface; it may be worthwhile to
choose a color derived from the expected value.
String name = "FormattedTextField.inactiveForeground";
ColorUIResource color = (ColorUIResource) UIManager.get(name);
UIManager.put(name, color.darker());
As an aside, I was recently critical of the demo's layout:
<http://groups.google.com/group/comp.lang.java.programmer/msg/39c807ad8e131973>
Line 132 in com.toedter.calendar.demo.JCalendarDemo is the problem:
splitPane.setDividerLocation(190);
Simply remove it to allow pack() to do the right thing.
--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
JDateChooser setEnabled Color Biagio <software@notario.it> - 2011-06-05 00:52 -0700
Re: JDateChooser setEnabled Color "John B. Matthews" <nospam@nospam.invalid> - 2011-06-05 13:29 -0400
Re: JDateChooser setEnabled Color Tom <tom400f@gmail.com> - 2011-06-05 21:39 +0000
Re: JDateChooser setEnabled Color "John B. Matthews" <nospam@nospam.invalid> - 2011-06-06 00:02 -0400
Re: JDateChooser setEnabled Color Tom <tom400f@gmail.com> - 2011-06-06 19:53 +0000
Re: JDateChooser setEnabled Color Biagio <software@notario.it> - 2011-06-06 02:15 -0700
Re: JDateChooser setEnabled Color Roedy Green <see_website@mindprod.com.invalid> - 2011-06-06 19:27 -0700
csiph-web