Background Image in JPanel.

Hi, I am trying to set a background image to my JPanel. So far everything ok. However When I add labels to this panel as well the image is displayed but the label is not! I tried to make a search on google, and I found some links pointing to this forum, however none of them (which) I have seen show how to display a backgroun image and a label on top.
What I tried to to is override the paint method of the JPanel. Here I did the following code:
public void paint(Graphics g){
   Image i = this.myImage // Were myImage is of type Image with a loaded image in.
   g = super.getGraphics();
   g.drawImage(i, 0, 0, this);
   super.paint(g);
}However this code brings the label and the image always blinking. I can imagine the reason for this is that the paint method is called all the time, and thus the image and the label are being painted all the time and so there is the blinking effect.
Does anyone know how I can set a background image to my JPanel in an efficient way?

No Gosling? I just retried it and it works for me.
Maybe you're having trouble with the image URL.
Try it with a local image.

Similar Messages

  • Background image  for JPanel using UI Properties

    Is there any way to add background image for JPanel using UI Properties,
    code is
    if (property.equals("img")) {
    System.out.println("call image file in css"+comp);
    //set the background color for Jpanel
    comp.setBackground(Color.decode("#db7093"));
    here the comp is JPanel and we are setting the background color,
    Is there any way to put the Background image for the JPanel ????

    KrishnaveniB wrote:
    Is there any way to put the Background image for the JPanel ????Override the paintComponent(...) method of JPanel.
    e.g.
    import javax.swing.*;
    import java.awt.*;
    import java.io.*;
    import javax.imageio.ImageIO;
    public class ImagePanel {
        public void createAndShowUI() {
            try {
                JFrame frame = new JFrame("Background Image Demo");
                final Image image = ImageIO.read(new File("/home/oje/Desktop/icons/yannix.gif"));
                JPanel panel = new JPanel() {
                    protected void paintComponent(Graphics g) {
                        g.drawImage(image, 0, 0, null);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setSize(new Dimension(400, 400));
                frame.setContentPane(panel);
                frame.setLocationRelativeTo(null);
                frame.setVisible(true);
            } catch (IOException ex) {
                ex.printStackTrace();
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    new ImagePanel().createAndShowUI();
    }

  • Background image for JPanel

    I was to come here and "search" for examples on this but i havnt found any so im jsut going to post it:
    How do i set an image to be the background of a JPanel? setBackground(image); doesnt work... i was toal something about paintComponent() but i tried it with that too and it didnt work... anyhelp would be greatly appreciated

    Ive tried many of the things that search suggested but none of them pertained enough to what i am doing for it to work. Here is my code:package gameFunctions;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Image;
    import java.awt.Toolkit;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    public class loginScreen extends JFrame implements ActionListener
         JTextField USERNAME, Username, PASSWORD, Password; // yeah i know, bad practice but there is some logic to the names relative to capitalization
         String username, password;
         JButton LOGIN;
         Dimension res = Toolkit.getDefaultToolkit().getScreenSize();
         ImageIcon background = new ImageIcon("C:\\FileTesting\\testImage.jpg");;
         JPanel pane;
    public static void main(String[] args)
              loginScreen frame = new loginScreen();
              frame.setVisible(true);
    public loginScreen()
              Container c = getContentPane();
              setSize(400, 300);
              setLocation((int)res.getWidth()/2-getWidth()/2, (int)res.getHeight()/2-getHeight()/2);
              setResizable(false);
              setLayout(null);
              pane = new JPanel();
              pane.setSize(getWidth(), getHeight());
              pane.setLayout(null);
              c.add(pane);
              USERNAME = new JTextField("Username:");
              USERNAME.setSize(68,25);
              USERNAME.setLocation(getWidth()/2-USERNAME.getWidth()/2-80, getHeight()/2-USERNAME.getHeight()/2-50);
              USERNAME.setEditable(false);
              pane.add(USERNAME);
              PASSWORD = new JTextField("Password:");
              PASSWORD.setSize(68,25);
              PASSWORD.setLocation(USERNAME.getX(), USERNAME.getY()+30);
              PASSWORD.setEditable(false);
              pane.add(PASSWORD);
              Username = new JTextField();
              Username.setSize(150,25);
              Username.setLocation(USERNAME.getX()+USERNAME.getWidth()+5, USERNAME.getY());
              Username.setEditable(true);
              pane.add(Username);
              Password = new JTextField();
              Password.setSize(150,25);
              Password.setLocation(Username.getX(), Username.getY()+30);
              Password.setEditable(false); // because im not working with PW's yet
              pane.add(Password);
              LOGIN = new JButton("LOGIN");
              LOGIN.setSize(80,30);
              LOGIN.setLocation(getWidth()/2-LOGIN.getWidth()/2, PASSWORD.getY()+30);
              pane.add(LOGIN);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
    public void actionPerformed(ActionEvent event)
    }i want "pane" to be the image of "background" imageIcon is the only thing that works like this because i dont know how to use straight up "Image". everything works if i set the ImageIcon "background" to be the background of JButton "LOGIN"
    any help would be greatly appreciated

  • Trouble with background image in JPanel

    I'm trying to get an image to display as a background image, and then put JLabels with other content on top of that background image. I've tried several things but can't figure out how to do it. Everytime I try, I get the images to display but the content is displayed side by side because of the layout manager.
    I've tried this but the image is displayed very tiny and still is not displayed in the background.
       //*   Draw background images for panels            *
           public class BackgroundPanel extends JPanel
          // the image you want displayed in the background
             private Image background;
          // A constructor to build and initialise your panel.
          // @param resourceName
              public BackgroundPanel(String resourceName)
                background = new ImageIcon( getClass().getClassLoader().getResource( resourceName )).getImage();
                setOpaque(false);
          // @see java.awt.Container#paint(java.awt.Graphics)
              public void paint(Graphics g)
                g.drawImage(background, 0, 0, 200, 480, this);          
             // draw the rest of the panel and it's children
                  super.paint(g);
          }

    To add a background to a Swing component, do not overload the public void paint(Graphics g); methods, but the public void paintComponent(Graphics g); instead, otherwise, the background will always overlap the Swing components added.
    Here is a goog working code:
    public void paintComponent(Graphics g) {
         super.paintComponent(g);
         g.drawImage(myStaticBackground, this.getWidth() - 256, this.getHeight() - 256, this);
    }In this example, I draw a static Image sized 256�256 at the bottom right corner.
    Fabruccio
    Java J2SE 1.5

  • Setting background image in JFrame

    Witam,
    Jak mozna ustawic tlo w postaci grafiki (png, jpg, ...) dla jFrame? Znalalem juz kilka sposobow ale one uzywaja jPanel, ktorego ja NIE moge uzyc ... niestety. Jesli nie ma takiej mozliwosci dla jFrame to moze tez byc dla jScrollPane, JComponent, Scene albo LayerWidget;)
    Hi,
    Is it possoble to use image as a background for jFrame? I know that it is possible to use jPanel and ser background image for jPanel, but in my project I cannot use it. Instead I can use jFrame, jScrollPane, Scene or LayerWidget.:)

    In the future, Swing related questions should be posted in the Swing forum.
    But there is already no need to post in the Swing forum because you already know the answer:
    I know that it is possible to use jPanel and ser background image for jPanel,
    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)", that demonstrates the incorrect behaviour.
    http://homepage1.nifty.com/algafield/sscce.html
    Don't forget to use the "Code Formatting Tags", so the posted code retains its original formatting.
    http://forum.java.sun.com/help.jspa?sec=formatting

  • Background image on a JPanel

    Hi
    I wonder if there's possible to set a background image, not just a colour, on a JPanel, and if so, how do I do it?
    /Nicklas

    import com.sun.image.codec.jpeg.JPEGCodec;
    import com.sun.image.codec.jpeg.JPEGImageDecoder;
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.io.InputStream;
    import javax.swing.*;
    public class PicPanel extends JPanel
    public PicPanel(InputStream theStream)
    try
    setPicture(theStream);
    setMinimumSize(new Dimension(picture.getWidth(), picture.getHeight()));
    setMaximumSize(new Dimension(picture.getWidth(), picture.getHeight()));
    setPreferredSize(new Dimension(picture.getWidth(), picture.getHeight()));
    setLayout(new GridBagLayout());
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    SwingUtilities.updateComponentTreeUI(this);
    catch(Exception e)
    e.printStackTrace();
    public void setPicture(InputStream i)
    try
    decoder = JPEGCodec.createJPEGDecoder(i);
    picture = decoder.decodeAsBufferedImage();
    catch(Exception e)
    e.printStackTrace();
    public void paintImmediately()
    super.paintImmediately(getBounds());
    public void paintComponent(Graphics g)
    Graphics2D g2 = (Graphics2D)g;
    g2.drawImage(picture, 0, 0, Color.white, null);
    paintChildren(g);
    JPEGImageDecoder decoder;
    BufferedImage picture;

  • Setting a jpanel as a background image

    i have managed to load the image into a jpanel but now need to know how to set the jpanel as a background image, to allow my jbuttons and textfields to be seen over the top

    that statement is unbeleivably true.
    right, heres my two classes, the first class is where i created the image
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.* ;
    import java.io.*;
    import javax.imageio.*;
    public class EmailBackgroundImage extends JComponent
    public void paint (Graphics g)
    File bkgdimage = new File ("background.jpg");
    Image imagebg = createImage ( 250,300 );
    try {
    imagebg = ImageIO.read(bkgdimage);
    catch (IOException e)
    g.drawImage(imagebg, 0, 0,null,null);
    this next class is where i'm trying to make the background
    youll notice remnants of my current attempt to create the background image.
    in its current state it does compile
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.* ;
    import java.sql.*;
    import java.util.*;
    import java.awt.color.*;
    public class emailFrontpage extends JFrame implements ActionListener
    JLabel FirstNameLabel = new JLabel("First Name");
    JLabel LastNameLabel = new JLabel("Last Name");
    JLabel EmailLabel = new JLabel("Email Address");
    JTextField FirstNameText = new JTextField( 10 );
    JTextField LastNameText = new JTextField( 10 );
    JTextField EmailAddressText = new JTextField( 20 );
    JPanel panel1 = new JPanel();
    JPanel panel2 = new JPanel();
    JPanel panel3 = new JPanel();
    JPanel panel4 = new JPanel();
    JPanel panel5 = new JPanel();
    JPanel image = new JPanel();
    JButton Enterbutton = new JButton("Enter Details");
    JButton Logon = new JButton("Log on");
    EmailBackgroundImage myimage;
    EmailEdit editEmp;
    emailFrontpage()
    getContentPane().setLayout( new BoxLayout( getContentPane(), BoxLayout.Y_AXIS ));
    myimage = new EmailBackgroundImage();
    image.add(myimage);
    myimage.setSize(250,300);
    image.setOpaque( false );
    FirstNameLabel.setForeground(Color.WHITE);
    LastNameLabel.setForeground(Color.WHITE);
    EmailLabel.setForeground(Color.WHITE);
    panel1.add(Logon);
    panel2.add(FirstNameLabel); panel2.add(FirstNameText);
    panel3.add(LastNameLabel); panel3.add(LastNameText);
    panel4.add(EmailLabel); panel4.add(EmailAddressText);
    panel5.add(Enterbutton);
    getContentPane().add(image);
    getContentPane().add(panel1);
    getContentPane().add(panel2);
    getContentPane().add(panel3);
    getContentPane().add(panel4);
    getContentPane().add(panel5);
    // .setBackground( Color.black )
    Enterbutton.addActionListener( this );
    Logon.addActionListener( this );
    Enterbutton.setActionCommand( "ENTERBUTTONPRESSED" );
    Logon.setActionCommand( "LOGONBUTTONPRESSED" );
    setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
    editEmp = new EmailEdit();
    public void actionPerformed( ActionEvent evt)
    if ( evt.getActionCommand().equals("LOGONBUTTONPRESSED") )
    emailLogonpage emaillogon = new emailLogonpage();
    emaillogon.setSize( 250, 300 );
    emaillogon.setVisible( true );
    emaillogon.setResizable(false);
    setVisible(false);
    else
    String newFN = FirstNameText.getText();
    String newLN = LastNameText.getText();
    String newEA = EmailAddressText.getText();
    editEmp.addNewEmail(newFN, newLN, newEA);
    setVisible(false);
    emailFrontpage emailfront = new emailFrontpage();
    emailfront.setSize( 250, 300 );
    emailfront.setVisible( true );
    emailfront.setResizable(false);
    public static void main ( String[] args )
    emailFrontpage emailfront = new emailFrontpage();
    emailfront.setSize( 250, 300 );
    emailfront.setVisible( true );
    emailfront.setResizable(false);
    }

  • Using image as background to Swing JPanel

    Hi,
    Have been trying to set background of JPanel to an image but cannot get it to work.
    Any ideas why not?! Here is the code Ive written:
    public Simple_Gui()
    //add the title for the frame
    super("Simple frame");
    this.getContentPane().setLayout(new FlowLayout());
    //add a window listener to close the window when the button is pressed
    this.addWindowListener(new WindowAdapter()
         public void windowClosing(WindowEvent we)     
              System.exit(0);
    //need a pane to hold the background image and buttons
         pane = createPanel();
    //this is the background image for the app to make it look lurrrvely
    ImageIcon imageIcon = new ImageIcon( "C://SDF_image.jpg" );
    //set the size of the Panel to the size of our image
    paneHeight = imageIcon.getIconHeight();
    paneWidth = imageIcon.getIconWidth();
    pane.setSize(paneWidth, paneHeight);
    //add the pane to the JFRAME so that it is visible
    this.getContentPane().add(BorderLayout.CENTER, pane);
    this.setVisible(true);
         public static JPanel createPanel()
              JPanel panel = new JPanel()
                   public void paintComponent(Graphics g)
              ImageIcon img = new ImageIcon("C://SDF_image.jpg");               Image image = img.getImage();
                   g.drawImage(image, 0, 0, this);                         super.paintComponent(g);                              }
              panel.setOpaque(false);
              panel.setLayout(new GridLayout(20, 4, 10, 10));
              panel.setVisible(true);
              return panel;
              public static void main(String[] args)
                   Smarty_Gui gui = new Smarty_Gui();
    Sorry about the indentation and format

    Something like this ...
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.*;
    public class UsingImageBackground extends JFrame {
    JPanel panel;
    JButton button = new JButton("OK!");
         public UsingImageBackground() {
       Container c = getContentPane();
         panel = new JPanel() {
              public void paintComponent(Graphics g)     {
                   ImageIcon img = new ImageIcon("new.jpg");
                   g.drawImage(img.getImage(), 0, 0, null);
                   super.paintComponent(g);
         panel.setOpaque(false);
         panel.add(button);
       c.add(panel);
         public static void main(String [] args){
              UsingImageBackground frame = new UsingImageBackground();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setSize(160, 120);
              frame.setVisible(true);
    }

  • How will I put a background Image in a JPanel?

    Can you help me on how will I put a background image in a JPanel?
    And also in a JDeskTopPane?

    Hint:
    Search the forum using two keywords in your subject. This question had been asked many times.

  • How do you set an image into the background of a JPanel or JFrame?

    How do you set an image into the background of a JPanel or JFrame?

    Something like this, Ive thrown in an ImageIcon on a
    button too for good measure.
    import java.awt.*;
    import javax.swing.*;
    public class JFrameImage extends JFrame {
    public JFrameImage() {
    Container c    = getContentPane();
    JPanel panel = new JPanel(){
                 public void paintComponent(Graphics g)     {
    ImageIcon img = new
    = new ImageIcon("background.jpg");
                      g.drawImage(img.getImage(), 0, 0, null);
                      super.paintComponent(g);
            panel.setOpaque(false);
    ImageIcon icon = new ImageIcon("onButton.jpg");
    JButton button = new JButton(icon);
    panel.add(button);
    c.add(panel);
    public static void main(String[] args) {
    JFrameImage frame = new JFrameImage();
    frame.setSize(200,200);
    frame.setVisible(true);
    Going totally fancy pants
    ImageIcon bigImage = new ImageIcon(bgImage.getImage().getScaledInstance(getWidth(), getHeight(),Image.SCALE_REPLICATE));
    g.drawImage(bigImage.getImage(), 0, 0, this); Will scale the image to the size of the panel
    whereas
    for (int y = 0; y  < getHeight(); y = y + image.getHeight(null))
    for (int x = 0; x< getWidth(); x = x + image.getWidth(null))
    g.drawImage(image, x, y, this); Will give a tiled effect
    Try tiling with an animated gif and bring your processor to a standstill.

  • How to set an image as background for a jPanel in an applet

    hi,
    I want to set an image as background for a jPanel component in an applet. I am using netbeans environment. I found that to set an image as a background for a jPanel is not possible. Could someone help me .
    Thanks in advance,
    Joshua

    public class ImagePanel extends JPanel
        private Image image = null;
        public void setImage(Image image)
            this.image = image;
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            g.drawImage(this.image, 0, 0, this);
    }Adjust to taste.

  • Problem with Background image and JFrame

    Hi there!
    I've the following problem:
    I created a JFrame with an integrated JPanel. In this JFrame I display a background image. Therefore I've used my own contentPane:
    public class MContentPane extends JComponent{
    private Image backgroundImage = null;
    public MContentPane() {
    super();
    * Returns the background image
    * @return Background image
    public Image getBackgroundImage() {
    return backgroundImage;
    * Sets the background image
    * @param backgroundImage Background image
    public void setBackgroundImage(Image backgroundImage) {
    this.backgroundImage = backgroundImage;
    * Overrides the painting to display a background image
    protected void paintComponent(Graphics g) {
    if (isOpaque()) {
    g.setColor(getBackground());
    g.fillRect(0, 0, getWidth(), getHeight());
    if (backgroundImage != null) {
    g.drawImage(backgroundImage,0,0,this);
    super.paintComponent(g);
    Now the background image displays correct. But as soon as I click on some combobox that is placed within the integrated JPanel I see fractals of the opened combobox on the background. When I minimize
    the Frame they disappear. Sometimes though I get also some fractals when resizing the JFrame.
    It seems there is some problem with the redrawing of the background e.g. it doesn't get redrawn as often as it should be!?
    Could anyone give me some hint, on how to achieve a clear background after clicking some combobox?
    Thx in advance

    I still prefer using a border to draw a background image:
    import java.awt.*;
    import java.awt.image.*;
    import javax.swing.border.*;
    public class CentredBackgroundBorder implements Border {
        private final BufferedImage image;
        public CentredBackgroundBorder(BufferedImage image) {
            this.image = image;
        public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
            int x0 = x + (width-image.getWidth())/2;
            int y0 = y + (height-image.getHeight())/2;
            g. drawImage(image, x0, y0, null);
        public Insets getBorderInsets(Component c) {
            return new Insets(0,0,0,0);
        public boolean isBorderOpaque() {
            return true;
    }And here is a demo where I load the background image asynchronously, so that I can launch the GUI before the image is done loading. Warning: you may find the image disturbing...
    import java.awt.*;
    import java.io.*;
    import java.net.URL;
    import javax.imageio.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class BackgroundBorderExample {
        public static void main(String[] args) throws IOException {
            JFrame.setDefaultLookAndFeelDecorated(true);
            JFrame f = new JFrame("BackgroundBorderExample");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JTextArea area = new JTextArea(24,80);
            area.setForeground(Color.WHITE);
            area.setOpaque(false);
            area.read(new FileReader(new File("BackgroundBorderExample.java")), null);
            final JScrollPane sp = new JScrollPane(area);
            sp.setBackground(Color.BLACK);
            sp.getViewport().setOpaque(false);
            f.getContentPane().add(sp);
            f.setSize(600,400);
            f.setLocationRelativeTo(null);
            f.setVisible(true);
            String url = "http://today.java.net/jag/bio/JagHeadshot.jpg";
            final Border bkgrnd = new CentredBackgroundBorder(ImageIO.read(new URL(url)));
            Runnable r = new Runnable() {
                public void run() {
                    sp.setViewportBorder(bkgrnd);
                    sp.repaint();
            SwingUtilities.invokeLater(r);
    }

  • Animated gif layered above background image

    I have a static background image which is displayed in a JPanel. I need to display animated gifs at certain positions on the base image. For every new frame of the animation, the paint method is called whcih attempts to load the entire base image + all the new animated images which is extremely slow!. It also means the animated gif keeps on getting loaded, and seldom gets beyond the first frame.
    Im sure many people have had to do something like this. Is the solution to draw the gifs on the glasspane (or use layered panes), and to have a seperate paint method? or is their a simple approach like setting a special clip area.

    thanks for the help...
    The size of the background image is approx 400*400 pixels (gif or jpg), and the icons are 25*25, and have between 1 and 6 frames.
    Here comes the code... I havent finished with the mediatracker stuff, but youll get the idea Im sure.
      public void paint(Graphics g) {
        MediaTracker tracker = new MediaTracker(this);
        tracker.addImage(image,0);
        try {tracker.waitForID(0);}
        catch (InterruptedException e){}
        g.drawImage(image, 0, 0, this); //draw background image (approx 400*400 pixels)
        int ICON_ID = -1;
        Image img;
        //draw all the icons...
        //all icons have between 1 and 6 frames. 25*25 pixels.   
        for (int i = 0; i < icon_IDs.size(); i++) {
          try {
            ICON_ID = new Integer(icon_IDs.elementAt(i).toString()).intValue();
            Point p = dm.getIconPosition(ICON_ID);
            if (isAlarm(ICON_ID)) {        //ITS AN ALARM - use animated gif
              img = getAlarmImage(ICON_ID);
            else                          //NORMAL ICON - no animation
              img = DataDefinition.getImageIcon(dm.getIconType(ICON_ID)).getImage();
            tracker.addImage(img,0);
            try {tracker.waitForID(0);}
            catch (InterruptedException e){}
            int width = DataDefinition.getSize(dm.getIconType(ICON_ID)).width;
            int height = DataDefinition.getSize(dm.getIconType(ICON_ID)).height;
            g.setClip(p.x, p.y, p.x+width, p.y+height);
            g.drawImage(img, p.x, p.y, p.x+width, p.y+height, 0,0,img.getWidth(this),img.getHeight(this),this);
          catch (SQLException sqle) {
            System.out.println("Could not find position of icon : " + ICON_ID);
      }

  • Problem in setting background Image to TabedPane.

    Hi Pals,
    I created a JFrame which consist of some components. The structure of the added components are given below.
    1) I added a JPanel (MainPanel) with background image in a JFrame.
    2) I added a JTabbedPane with 7 tabs in the previous JPanel (MainPanel).
    3) Each tabs in the JTabbedPane having JPanel with Background Image.
    This is my Frame Structure. but i haven't problem to run in JDK1.6,1.5. It is working perfect. But when am run in lower version like 1.3 or 1.4. The design is looking bad. The JTabbedPane overlap the (MainPanel). The background image of the (MainPanel) was hided. I set setOpaque(false) for the JTabbedPane. But it also not working. How can i solve this problem.
    By,
    Mohan

    Your problems appear to stem from your choice of layout manager(s). To get better help sooner, post a [_Short, Self Contained, Compilable and Executable, Example Program (SSCCE)_|http://mindprod.com/jgloss/sscce.html] that clearly demonstrates your problem.
    To post code, use the code tags -- [code]Your Code[/code] will display asYour CodeOr use the code button above the editing area and paste your code between the {code}{code} tags it generates.
    db

  • How to load a background Image on a JDialog object

    Hi All, Actually i am new to java programing and i am stuck in this problem. I am developing a java application which is dialog based (using JDialog objects) and i want to load a background image on my dialog. I hope this could be done and i really appreciate your help because i must deliver this project and this is a user interface requirement.

    Try something along the lines of this: Create a new class called BackgroundImagePanel and have it extend JPanel.
    Have an attribute in the class for your image, and a method to set it.
    Override isOpaque() to return true.
    Override the paintComponenet method as such:
    public void paintComponent (Graphics g) {
    super.paintComponent(g);
    if( image == null ) return;
    Icon icon = new ImageIcon(image);
    icon.paintIcon(this, g, x, y);
    Add this panel to your JDialog and then add other component to this panel.
    You might have to tweak this a bit, but it should get you close...
    Bill

Maybe you are looking for