?
Solved

Wallpaper in applet & frame

Posted on 1997-03-26
3
Medium Priority
?
220 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month14 days, 4 hours left to enroll

801 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