Solved

Programming

Posted on 1998-07-16
3
201 Views
Last Modified: 2010-03-30
Can I use an image as background in application program ? Can I put TextFields and Buttons on the image?  
If can, how to code this? Could you please give me an example?
0
Comment
Question by:AmyS
3 Comments
 

Author Comment

by:AmyS
ID: 1226870
Edited text of question
0
 

Expert Comment

by:mintt
ID: 1226871
sure you could,
check out on Panel Class
create your application base on Panel Class.
You can place what ever you like on panel.
draw background image in panel class.
0
 
LVL 16

Accepted Solution

by:
imladris earned 20 total points
ID: 1226872
Specifically, you should derive a panel of your own from the
Panel class. Then override the paint method to supply whatever
graphics you like. If you want to use show an Image it would be
something along the lines of:

class ImagePanel extends Panel
{   Image background;

    ImagePanel(Image bkg)
    {   background=bkg;
        return;
    }

    public void paint(Graphics g)
    {   g.drawImage(background,0,0,this);
        return;
    }
}

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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 …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

838 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