Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help setting Component bacground Color !

0 views
Skip to first unread message

Brian Simard

unread,
Nov 17, 1996, 3:00:00 AM11/17/96
to

I am trying to do set the background color of a button as follows!

if (eventHash.containsKey(HashCheck))
{
myButton[i+buttonShift-1].setBackground(Color.blue);
myButton[i+buttonShift-1].repaint();
}

However when i try to run it i get the following messages in my Debug
window :

java.lang.InternalError: getGraphics implemented only for Canvas
Components
at sun.awt.win32.Win32Graphics.<init>(Win32Graphics.java:45)
at sun.awt.win32.MComponentPeer.getGraphics(MComponentPeer.java:185)
at sun.awt.win32.MComponentPeer.handleRepaint(MComponentPeer.java:283)
at sun.awt.win32.MToolkit.run(MToolkit.java:65)

hese messages lead me to believe that I cannot yet set a components
Color !

Please someone tell me it is not so !
(and How to do it !)

Thanks !


--
Brian Simard
aur...@cyberus.ca

Dino Morelli

unread,
Nov 18, 1996, 3:00:00 AM11/18/96
to

I was recently trying to set the background color (and foreground color) of
buttons to something other than their default.

I wasn't using arrays and I didn't get errors, but it just didn't seem to
do anything.

The reason I started messing with this is that under the Mac JVM buttons
paint in the same color as the container that's holding them. They don't
default to grey and it looks stupid. So I was trying to force the buttons
to a specific color.

I was wondering if all this is bugs in AWT, or is a simple setBackground()
or setForeground() call not enough.

Dino Morelli (dmor...@nai.net)

Brian Simard <bri...@cyberus.ca> wrote in article
<01bbd4db$0d37aee0$60a2...@cyberus.cyberus.ca>...

0 new messages