GeeCON Prague 2014*
The moose likes Game Development and the fly likes Background color doesn't change using setBackground() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Game Development
Bookmark "Background color doesn Watch "Background color doesn New topic
Author

Background color doesn't change using setBackground()

Raman Ghai
Ranch Hand

Joined: Jan 01, 2012
Posts: 51
I am following some tutorials for making games:
Here are my classes:
Screen.java

Main.java


I get the text on the screen but the background color is black ...
I have no idea about this. Any suggestions ?
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

You should call:



PM Me If You Want to get Urgent Help on Java Programming
Raman Ghai
Ranch Hand

Joined: Jan 01, 2012
Posts: 51
Nam Ha Minh wrote:You should call:


When I use the above code, I get an error saying "nonstatic method cant be accessed from a static context."
So, I simply used but still nothing .
I get a BLACK background with blue text written on it .

If I change the color quality to 32 bit in the DisplayMode() constructor , the background doesn't appear .
It simply writes the text on the desktop.

Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

Hi, I have tried to compile and run your program. I see the red background, but after a while an exception is thrown:

Raman Ghai
Ranch Hand

Joined: Jan 01, 2012
Posts: 51
Hi there,
This means that the display mode is not supported by the videocard. Well , I will run the code on my desktop as well . And try different display modes
such as


By the way , the screen size of my laptop is 1366 x 768 , color quality = 32 bit , refreshrate = 60 .
This is strange that my laptop didn't give any exception about the invalid display mode. I used command line to compile and run the programs . which IDE did you(Mr Nam Ha Minh) use ?
I think it should not make any difference but we never know .
thanks for replying
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Background color doesn't change using setBackground()