Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #4990 > unrolled thread
| Started by | Biagio <software@notario.it> |
|---|---|
| First post | 2011-06-05 00:52 -0700 |
| Last post | 2011-06-06 19:27 -0700 |
| Articles | 7 — 4 participants |
Back to article view | Back to comp.lang.java.programmer
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
| From | Biagio <software@notario.it> |
|---|---|
| Date | 2011-06-05 00:52 -0700 |
| Subject | JDateChooser setEnabled Color |
| Message-ID | <543b5b7c-b7f7-4445-91fb-8f65391a8c68@n11g2000yqf.googlegroups.com> |
Hi, I'm using the powerfull JDateChooser JCalendar library 1.3.3. Unfortunately, when the component is setEnabled (false) the color of date is a gray almost unreadable. 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? Thanks Biagio
[toc] | [next] | [standalone]
| From | "John B. Matthews" <nospam@nospam.invalid> |
|---|---|
| Date | 2011-06-05 13:29 -0400 |
| Message-ID | <nospam-DF21D0.13292205062011@news.aioe.org> |
| In reply to | #4990 |
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>
[toc] | [prev] | [next] | [standalone]
| From | Tom <tom400f@gmail.com> |
|---|---|
| Date | 2011-06-05 21:39 +0000 |
| Message-ID | <isgt21$hum$1@speranza.aioe.org> |
| In reply to | #4991 |
On Sun, 05 Jun 2011 13:29:22 -0400, John B. Matthews wrote: > 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. Ah - didn't realise it was only the demo program you were unhappy about... Anyway, the aforementioned additions were: - nullText property - if the JDC's date is null then display any null text, for example "Open Ended" - selectOnFocus property - optionally select the text when the editor gets the focus - dateVerifier property - an interface that JDC calls back on to allow client code to indicate whether a date is selectable; calendar buttons are disabled for invalid dates and the editors skip to the next valid date in the "direction of travel" - use action map to (ctrl-c) popup the calendar; (ctrl-n) set to null - provide access to the DateFormat inside so you can (eg) set its timezone I'm in the process of pulling together other people's mods and will github all this soon...
[toc] | [prev] | [next] | [standalone]
| From | "John B. Matthews" <nospam@nospam.invalid> |
|---|---|
| Date | 2011-06-06 00:02 -0400 |
| Message-ID | <nospam-6ED388.00023706062011@news.aioe.org> |
| In reply to | #4995 |
In article <isgt21$hum$1@speranza.aioe.org>, Tom <tom400f@gmail.com> wrote: > On Sun, 05 Jun 2011 13:29:22 -0400, John B. Matthews wrote: > > > 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. > > Ah - didn't realise it was only the demo program you were unhappy > about... Honestly, I didn't know either. :-) It was just the first thing I ran across, and I feared it was an ill omen. Of course, the more I use it, the more I like it. > Anyway, the aforementioned additions were: > - nullText property - if the JDC's date is null then display any null > text, for example "Open Ended" > > - selectOnFocus property - optionally select the text when the editor > gets the focus > > - dateVerifier property - an interface that JDC calls back on to > allow client code to indicate whether a date is selectable; calendar > buttons are disabled for invalid dates and the editors skip to the > next valid date in the "direction of travel" > > - use action map to (ctrl-c) popup the calendar; (ctrl-n) set to null > > - provide access to the DateFormat inside so you can (eg) set its > timezone The dateVerifier looked especially appealing, although I'd since reverted to the stock 1.3.3. It's clear you've worked with it extensively; I'd welcome any comment you have on my response to the OP. > I'm in the process of pulling together other people's mods and will > github all this soon... Excellent. -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews>
[toc] | [prev] | [next] | [standalone]
| From | Tom <tom400f@gmail.com> |
|---|---|
| Date | 2011-06-06 19:53 +0000 |
| Message-ID | <isjb7k$fhu$1@speranza.aioe.org> |
| In reply to | #5000 |
On Mon, 06 Jun 2011 00:02:37 -0400, John B. Matthews wrote: > The dateVerifier looked especially appealing, although I'd since > reverted to the stock 1.3.3. It's clear you've worked with it > extensively; I'd welcome any comment you have on my response to the OP. Looks like its gone down a storm... I'd agree that tweaking the UI defaults is not generally a good idea but that if you do, stick to the ones that are common (or at least always likely to be present) across all L&F you might be running under. If you want to see what UI defaults there are then I recommend Rob Camick's utility for browsing them: http://tips4java.wordpress.com/2008/10/09/uimanager-defaults/ @Biagio - of course all your text fields will look the same when disabled, so your problem is not limited to JDateChooser's text field....
[toc] | [prev] | [next] | [standalone]
| From | Biagio <software@notario.it> |
|---|---|
| Date | 2011-06-06 02:15 -0700 |
| Message-ID | <6c952213-9fbe-4bff-8771-6cb8349354ed@28g2000yqu.googlegroups.com> |
| In reply to | #4991 |
On 5 Giu, 19:29, "John B. Matthews" <nos...@nospam.invalid> wrote: > In article > <543b5b7c-b7f7-4445-91fb-8f65391a8...@n11g2000yqf.googlegroups.com>, > > Biagio <softw...@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/39c807ad...> > > 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> Thanks !!!! Biagio
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2011-06-06 19:27 -0700 |
| Message-ID | <5v2ru6p9dshq4mgmmlgqoi2dgkgn5oqgdc@4ax.com> |
| In reply to | #4990 |
On Sun, 5 Jun 2011 00:52:01 -0700 (PDT), Biagio <software@notario.it> wrote, quoted or indirectly quoted someone who said : >Hi, > >I'm using the powerfull JDateChooser JCalendar library 1.3.3. > >Unfortunately, when the component is setEnabled (false) the color of >date is a gray almost unreadable. > >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? I wrote a DateChooser. If it is defective, I will fix it as top priority. If you want something eccentric, you have the complete source code. See http://mindprod.com/products1.html#SPINNER The class you want is called DateSpinner. You can see it in use at http://mindprod.com/applet/canadiantax.html or http://mindprod.com/applet/bio.html -- Roedy Green Canadian Mind Products http://mindprod.com How long did it take after the car was invented before owners understood cars would not work unless you regularly changed the oil and the tires? We have gone 33 years and still it is rare to uncover a user who understands computers don't work without regular backups.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web