• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Java applet window: color

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my JDK 1.4 Swing code, I have a line that pops up a dialog:
JOptionPane.showMessageDialog(... "My message", ...);

During startup, I have set the background color:
ColorUIResource c = new ColorUIResource(new Color(237,237,237));
UIManager.put("OptionPane.background", c);
This just sets the backgroud color to a blue color.

This works fine when running as a Swing application. The dialog
shows up and has the blue color specified.
When running as an applet, the dialog gets a blue background,
but at the bottom is a label that reads "Java Applet Window"
and that portion of it has a different color (gray).
How can I fix this? Ideally, it would be nice if the Label/text itself
could go away. But if not, can I atleast change the color to match
the rest of the dialog window?
Thanks for your help.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put this line in the init() method and your applet window background will be set to blue:
this.getContentPane().setBackground(Color.blue);
 
I'm not sure if I approve of this interruption. But this tiny ad checks out:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic