File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 694
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: 694
The only change I needed was to use Class getResource() to run it from a jar file. And to remove the Exit on close.
I agree. Here's the link:
subject: Nonmodal window showing image
It's not a secret anymore!