aspose file tools
The moose likes Swing / AWT / SWT and the fly likes background and foreground color is not changing in full screen window Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "background and foreground color is not changing in full screen window" Watch "background and foreground color is not changing in full screen window" New topic
Author

background and foreground color is not changing in full screen window

Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 908
why my background and foreground color is not changing??

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

Please post an SSCCE. Right now I get compiler errors about missing class "Screen". Since that's doing the actual full screen handling we can't test anything.

That said, overriding the paint method is the AWT way to go. In Swing you override paintComponent. However, JFrame (and JWindow and JDialog) don't have that method; instead you should set its content pane to be some container (usually JPanel) that does override paintComponent.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 908
sorry for not posting the sscce code, here is that, and i also changed my code as you said, although after overriding paintComponent i am able to get background color, but text is not visisble.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

You're still overriding paint. Like I said, you should override paintComponent instead:
After a short black screen I now get a pink-ish background with grey letters "This is FullScreen".
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 908
okay i was not doing this
super.paintComponent(g);
therefore i was not getting it...

Thank you.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: background and foreground color is not changing in full screen window
 
Similar Threads
nullPointerException found regarding Window
background color is not changing?
Java Tetris
Images don't painting
Developing Games In Java chapter 2 example not doing as i would have expected