File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes custom background in applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "custom background in applets" Watch "custom background in applets" New topic

custom background in applets

Douglas Wolfinger
Ranch Hand

Joined: Aug 28, 2000
Posts: 57
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");
Michael Ernest
High Plains Drifter

Joined: Oct 25, 2000
Posts: 7292

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

Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
I agree. Here's the link:
subject: custom background in applets
It's not a secret anymore!