Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Wallpaper in applet & frame

Posted on 1997-03-26
3
Medium Priority
?
222 Views
Last Modified: 2012-05-04
Every time when I set the wallpaper, all the component
will be shaded by the wallpaper.How can I set the wallpaper
as the background in applet or frame?
0
Comment
Question by:kcheung3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Expert Comment

by:heech
ID: 1219271
For each component separately..try doing a setBackGround
to whatever color you want instead of the wallpaper?

0
 

Author Comment

by:kcheung3
ID: 1219272
In fact, I want to set the background with an image instead of background color.
Anyway, thank for your kind responds.
0
 

Accepted Solution

by:
mjl earned 100 total points
ID: 1219273
Here is an applet I grabbed somewhere to do tiled background:
I haven't personally used it so I cant ensure that it works but
give it a shot.

import java.awt.*;
import java.applet.Applet;

public class ExtendedPanel extends Applet {
      Image backgroundImage = null;

      // applet init() - recieve and load background image
      public void init() {
            backgroundImage = getImage(getDocumentBase().getParameter("BGImage"));
      }

      // applet update() - dont clear, paint over it
      public void update( Graphics g) {
            paint(g);
      }

      // applet paint() - paint applet
      public void paint(Graphics g) {
            if(backgroundImage != null) {
                  int x_offset = 0, y_offset = 0;
                  while(y_offset<this.size().height) {
                        x_offset = 0;
                        while(x_offset<this.size().width) {
                              g.drawImage(backgroundImage, x_offset, y_offset, this);
                              x_offset=x_offset+backgroundImage.getWidth(null);
                        }
                        y_offset=y_offset+backgroundImage.getHeight(null);
                  }
            } else {
                  g.clearRect(0, 0, this.size().width, this.size().height);
            }
      }
}


Best of luck with this.

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
In this post we will learn different types of Android Layout and some basics of an Android App.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question