• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Using a FileChooser to get and display an image

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!


 
Marshal
Posts: 25460
65
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Marshal
Posts: 68956
275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 : )
 
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic