File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes To Display background image in a Jframe/JPanel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "To Display background image in a Jframe/JPanel" Watch "To Display background image in a Jframe/JPanel" New topic
Author

To Display background image in a Jframe/JPanel

satya sahu
Ranch Hand

Joined: Mar 26, 2003
Posts: 97
How do i place a background image for a JFrame/JPanel?.

I have 2 panels within a frame. I need to set a background image for the Frame.

Please lemme know how do i do it?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> I need to set a background image for the Frame.

create a JPanel, set to BorderLayout (or whatever), then set the panel as
the contentPane of the frame. Now add components to the panel, as you would
the frame.

the swing FAQ (link on swing main page, above topics) has an example of a
JPanel with background image - this is what you'd use for your contentPane
satya sahu
Ranch Hand

Joined: Mar 26, 2003
Posts: 97
Actually i have a panel in the Frame, where i have to put the background image and also i have few swing controls(labels, combobox, textbox....). So if possible can somebody please give me some sample code or some related links.

Please help me ASAP.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> So if possible can somebody please give me some sample code

sample code of what?

the link shows you how to have a JPanel with a background image,
all you then do is add components to the panel, as you would a normal JPanel.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: To Display background image in a Jframe/JPanel