Results 1 to 5 of 5
- 10-11-2010, 12:23 PM #1
Member
- Join Date
- Sep 2010
- Posts
- 10
- Rep Power
- 0
- 10-11-2010, 02:19 PM #2
What have you tried? I googled "java background image" and got a ton of results. Did you try any of them? Where are you stuck?
- 10-11-2010, 05:37 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
There doesn't exist no such thing as a 'background image' on any Swing component. You can paint an image on a JComponent and Swing does the rest. You do the painting in the paintComponent(Graphics g) method and Swing takes care of the clipping (in case the component has any visible child components).
kind regards,
Jos
- 10-14-2010, 07:29 AM #4
Member
- Join Date
- Sep 2010
- Posts
- 10
- Rep Power
- 0
Hi,
The below is the code for the background image for panel ..
and this panel has a button over there when i click i need to change the background image....
ImageIcon othericon=new ImageIcon("images/03_Menu.png");
Others = new javax.swing.JPanel()
{
protected void paintComponent(Graphics g)
{
g.drawImage(othericon.getImage(), 0,0, null);
super.paintComponent(g);
}
}
;
Thank you
- 10-14-2010, 08:18 AM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
change panel background at runtime
By cahyadiakbar in forum AWT / SwingReplies: 2Last Post: 08-26-2010, 08:16 AM -
Change JPanel background after its been set once
By mevets in forum AWT / SwingReplies: 4Last Post: 04-14-2010, 01:07 AM -
change Panel Color
By aadi_j in forum AWT / SwingReplies: 2Last Post: 11-16-2009, 10:12 AM -
how to change windows xp background image through java
By erosenthil in forum Advanced JavaReplies: 1Last Post: 08-18-2009, 12:57 PM -
when muse pressed the background change
By pcman in forum Java AppletsReplies: 1Last Post: 03-17-2008, 11:51 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks