I have this problem with graphics, actually I know it's with my compiler... If I try to set the background of a button or something I get erros that's not even in my code..

I have this:

btnCalc.setBackground(Color.blue);

and I get theses errors

//g is already defined
Graphics g = new Graphics();
 
//Graphics is abstract
Graphics g = new Graphics();
 
//variable yellow
g2d.setBackground(Color.yellow);

The weird thing is, I don't have those statements anywhere in my code. So does anyone know what's going on?

NOTE: This is not an applet, this is a JFrame.

Recommended Answers

All 8 Replies

are you saving your file name right is it simmalar to another project that might have those commands


This is my 300th post yippie

Or are you linking to a 3rd party library which may be missing something?

I tried compiling with JCreator, and it worked....? So why would compiling at the command line, be any different from compiling with JCreator? I mean, don't they use the same thing ?

don't know JCreator. It probably uses an internal JVM which is likely an old(er) version.
There's also classpath issues to consider.

I don't know much about JCreator either..Never used it before, but it's compiling things that the command line doesn't, so I guess I'll have to stick to that for a while. My guess would also be that it uses a JVM that runs an older version.

I'm wondering if the jvm has become corrupt or something.

hey can u paste fulll code ?

I could, but I know for a fact it's not the code. Maybe later I will, but right now I have school.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.