Results 1 to 3 of 3
- 03-24-2008, 04:43 AM #1
Member
- Join Date
- Jan 2008
- Posts
- 16
- Rep Power
- 0
- 03-24-2008, 05:04 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
This may help you. I used ImageIcon here, but not tested. Just writing this code on my memory :)
After that get a content pane for your GUI(components actually.) There is a method called setBackgroundImage() where you can set the backgroundImage there.Java Code:ImageIcon icon = new ImageIcon(your_image_path_here); backgroundImage = icon.getImage();
- 03-24-2008, 05:29 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Using a Jpanel you can easily done this. Why I suggest to use a JPanel is, on top of that you can easily work on with other controls. In some cases of my projects I used JLables also. Add a image on that and do my process. But on a Lable I can't add any other component. But in JPanel you can do it. On working with JLables ToolKit gives a nice support.
See how I use a Lable and JPanle used here. I think it is clear to you.Java Code:ImageIcon imageBack = new ImageIcon(your_image_Path_here); JLabel background = new JLabel(imageBack); background.setBounds(0, 0, imageBack.getIconWidth(), imageBack.getIconHeight()); getLayeredPane().add(background, new Integer(Integer.MIN_VALUE)); jPanel1.setOpaque(false); setContentPane(jPanel1);
Similar Threads
-
Add an image to JFrame
By Eranga in forum AWT / SwingReplies: 4Last Post: 02-01-2010, 03:09 PM -
Center background image
By Floetic in forum AWT / SwingReplies: 1Last Post: 04-24-2008, 05:50 PM -
Background image in java
By toby in forum AWT / SwingReplies: 1Last Post: 07-29-2007, 07:15 AM -
Why this image background is black ?
By samson in forum Java 2DReplies: 1Last Post: 07-17-2007, 04:24 AM -
Problem Setting offscreen background
By D34N0 in forum Java AppletsReplies: 1Last Post: 07-14-2007, 11:46 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks