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 How to Create Image In a Frame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to Create Image In a Frame" Watch "How to Create Image In a Frame" New topic
Author

How to Create Image In a Frame

Koh Khai Huat
Ranch Hand

Joined: Aug 05, 2005
Posts: 100
Hi guys

i need help on how to Create Image In a Frame or set the frame's background as the Image.

sample code will be gladly Aprecitated thanks

regards


if (!WorkHard){
System.out.println("Fail!!!");
}
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

1) use an ImageIcon object inside a JLabel
2) use paintComponent (for Swing) that draws an Image on the Graphics object


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Iv'e found that a flexible way to create a background image on a Swing
container is to define a border and have it draw the image:This way you don't have to subclass the contain in order to give it a
background image. Demo:


There is no emoticon for what I am feeling!
 
Don't get me started about those stupid light bulbs.
 
subject: How to Create Image In a Frame
 
Similar Threads
Image in JFrame ???
Stretch the image size.
awt
splash screen
desktop ScreenShot