Re: cobbling a ComboBox
- From: Daniele Futtorovic <da.futt.news@xxxxxxxxxxxxxxx>
- Date: Tue, 24 Jun 2008 01:11:07 +0200
On 2008-06-23 23:43 +0100, Albretch Mueller allegedly wrote:
I have a JComboBox that looks like this:
http://www.geocities.com/tekmonk2005/pix/ComboBoxColors.jpg
I would like to use the color on the top title bar to use it as the
background of the selected item in the combobox, so it kind of looks like a
continuation of what was suggested in the title bar
But I don't know how to ask the UI Manager to give me the color of the top
title bar a JFrame uses. If you go:
UIManager.get("InternalFrame.borderColor")
you will get something like:
javax.swing.plaf.ColorUIResource[r=238,g=238,b=238]
Which is the grey color of the default Window background in the Metal L&F
Try UIManager.getColor(Object).
Also I don't know how to only have the selection boldened (as in the window
bar), when the selection is made. If you go:
UIManager.put("ComboBox.font", new Font("Monospaced", Font.PLAIN +
Font.BOLD, 16));
The font stays bold all the time
I would like for it to be bold only when you select it
Is this possible?
Don't know about that. You might try to dump all the UIManager keys
(UIManager.getDefaults().keySet()) and look for the appropriate key.
Alternatively, find a webpage which lists all of them -- unfortunately,
I'm not aware of such a resource.
Chances are such nuanced behaviour as you want may not be available. In
that case, you may end up having to write/override the ComponentUI itself.
--
DF.
to reply privately, change the top-level domain
in the FROM address from "invalid" to "net"
.
- Follow-Ups:
- Re: cobbling a ComboBox
- From: Albretch Mueller
- Re: cobbling a ComboBox
- References:
- cobbling a ComboBox
- From: Albretch Mueller
- cobbling a ComboBox
- Prev by Date: cobbling a ComboBox
- Next by Date: Re: How to combine characters
- Previous by thread: cobbling a ComboBox
- Next by thread: Re: cobbling a ComboBox
- Index(es):
Relevant Pages
|