wood burning stoves 2.0
The moose likes Java in General and the fly likes Nonmodal window showing image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Nonmodal window showing image" Watch "Nonmodal window showing image" New topic

Nonmodal window showing image

Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 691
I have an app that displays a question in a textarea and choices of answers in a list. Some of the questions have an image associated with them.
I don't normally use Swing classes, but in this case I thought they'd be useful.

What class(es) can I use to show an image in a non-modal window?
I want to display the window with an image when the associated question is being asked and dispose of it when the user moves on to the next question.

Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Use javax.swing.JLabel + javax.swing.ImageIcon:

This should probably be in the Swing forum.

There is no emoticon for what I am feeling!
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 691
The only change I needed was to use Class getResource() to run it from a jar file. And to remove the Exit on close.
It is sorta covered in the JavaRanch Style Guide.
subject: Nonmodal window showing image