File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

background and foreground color is not changing in full screen window

 
Punit Jain
Ranch Hand
Posts: 1012
2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why my background and foreground color is not changing??

 
Rob Spoor
Sheriff
Pie
Posts: 20381
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20381
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1012
2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay i was not doing this
super.paintComponent(g);
therefore i was not getting it...

Thank you.
 
Rob Spoor
Sheriff
Pie
Posts: 20381
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic