This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

custom background in applets

 
Douglas Wolfinger
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I establish a background from a file in an applet?
I made this feeble attempt, but it doesn't work...
image = getImage(getCodeBase(), "u17bkgrd.jpg");
setBackground(image);
Thanks
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If only it was that easy! setBackground() only takes an RGB color, so to do an Image you need to paint it on, then paint over that to give the impression of a background.
You can modify the "bleed" or alpha value of an Image to render a half-tone impression. But to get really fancy, Swing widgets or even using the Java 2D is the way to go; steeper learning curve, but you then get cool effects.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic