Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: "John B. Matthews" Newsgroups: comp.lang.java.programmer Subject: Re: JDateChooser setEnabled Color Date: Sun, 05 Jun 2011 13:29:22 -0400 Organization: The Wasteland Lines: 54 Message-ID: References: <543b5b7c-b7f7-4445-91fb-8f65391a8c68@n11g2000yqf.googlegroups.com> NNTP-Posting-Host: LQJtZWzu+iKlBROuDg+IUg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4991 In article <543b5b7c-b7f7-4445-91fb-8f65391a8c68@n11g2000yqf.googlegroups.com>, Biagio wrote: > I'm using the powerfull JDateChooser JCalendar library 1.3.3. I assume you mean com.toedter.calendar.JDateChooser, found here: > 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: 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