This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Using a FileChooser to get and display an image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Using a FileChooser to get and display an image" Watch "Using a FileChooser to get and display an image" New topic
Author

Using a FileChooser to get and display an image

Alison Davis
Greenhorn

Joined: Nov 30, 2009
Posts: 2
Hi everyone,

Basically, I'm trying to add this code to an 'open image' button. I'd like it to display the image in a JFrame, and I think I've got most of it sorted, but there's obviously something that I'm missing. If anyone can point it out, it'd be fantastic!


Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

What makes you think you are missing something?

I notice that you ask the user to select a file, then you make that file into an image (ignoring any exceptions which might be thrown), then you don't do anything with the image. Was that the something you were missing, or were there some other symptoms you could tell us about?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38075
    
  22
Welcome to JavaRanch

Please use the CODE button; I shall try to edit your post (since you are new) so you can see how much better it looks.
Alison Davis
Greenhorn

Joined: Nov 30, 2009
Posts: 2
Thankyou - yes, I was missing the fact that I wasn't actually doing anything with the image! Silly me.

Didn't notice the code option, duly noted, and thanks again : )
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using a FileChooser to get and display an image
 
Similar Threads
ImageIcon not working
HELP! me pls i can't open image on JLabel
FileFilter for excluding all files (*.*)
how to open picture in JPanel
display image selected by Jfilechooser on the content pane of the frame