> What's a good way to indicate that one of several JButtons is recommended in
> a given situation? I tried changing the background color, but I don't like
[quoted text clipped - 8 lines]
>
> TIA
Maybe you could give the button a border and change its color?
Ed - 21 Aug 2005 04:15 GMT
> Maybe you could give the button a border and change its color?
I tried changing the background color, but I didn't like the results because
it overrides the metal shading L&F and gives the button a solid color. Plus
I discovered that there's no consensus on what a particular color means.
For instance, I shaded the suggested button PINK, and several folks told me
they interpreted PINK to mean "don't click here." :/
I'll play with the foreground color ... maybe going to a darker gray will do
the trick. I'll try adding a border too. Doesn't a button already have a
border, though? If so, I'd be overriding the default border with a new
one, and I'd have to get the default one so I could set it back, right?
I was hoping there was something in the API explicitly for this purpose,
like button.setHighlighted() or something. Oh well, thanks for the help.
Sean - 21 Aug 2005 10:22 GMT
>>Maybe you could give the button a border and change its color?
>
[quoted text clipped - 11 lines]
> I was hoping there was something in the API explicitly for this purpose,
> like button.setHighlighted() or something. Oh well, thanks for the help.
I'm not talking about the background color, I'm talking about creating a
border around the button with a certain color, and you can set
"isVisible" to true or false depending on when you want to draw
attention to it.
> What's a good way to indicate that one of several JButtons is recommended
> in a given situation? I tried changing the background color, but I don't
> like the results. Is there an API method to "highlight" the button?
Of course there is lot of API. See
<http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JButton.html#method_summary>
(and don't forget the methods inherited from AbstractButton, JComponent,
...) to find a setXxxx() method that makes sense for your
highlighting/coaching. There are setBorder (as mentioned already by the
other poster), setBackground, setForeground, setIcon, setFont, ...
Or for being creative, you could even develop your own subclass of JButton
with a brand-new setGimmick() method and an overridden paintComponent()
method.
> I considered setting the button as the default button. But if the button
> changes frequently, will that be a hassle?
[quoted text clipped - 4 lines]
>
> TIA

Signature
"TFritsch$t-online:de".replace(':','.').replace('$','@')
Ed - 21 Aug 2005 22:21 GMT
I think I found a good solution using icons ... a little green "Check" and a
little red "X".
>> What's a good way to indicate that one of several JButtons is recommended
>> in a given situation? I tried changing the background color, but I don't
[quoted text clipped - 17 lines]
>>
>> TIA
Thomas Hawtin - 22 Aug 2005 13:31 GMT
> I think I found a good solution using icons ... a little green "Check" and a
> little red "X".
Off hand, I'd go for a little, electric-green arrow underneath the
button for good. Nothing (no clutter) for bad. Try out a few ideas and
see which gets universally understood and liked by players.
Tom Hawitn

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/