Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

JOptionPane Icons

Posted on 2001-08-18
2
Medium Priority
?
1,213 Views
Last Modified: 2008-03-10
I have a couple of JInternalPane's that could use some icons.

The JOptionPane's icons work great, however I don't want to actually create a JOptionPane to get at them. I tried to track them down by looking at Sun's source code and by looking through the jars in the jre\lib directory (rt.jar, etc) and lib directory (tools.jar, etc).

But no Luck.

Anyone know where they hide these things?
Better yet, does anyone know of a way to grab them from code without creating an instance of JOptionPane?
0
Comment
Question by:mbunkows
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
ozymandias earned 800 total points
ID: 6403228
These icons are managed by the UIManager and are stored inthe UIDefaults hashtable.

You can get at them like this :

import java.awt.*;
import javax.swing.*;

public class UIIcons extends JFrame{

     Container contentPane;

     public UIIcons(String[] args){
          super("UIIcons");
          this.setDefaultCloseOperation(EXIT_ON_CLOSE);
          contentPane = this.getContentPane();
          contentPane.setLayout(new FlowLayout());
          contentPane.add(new JLabel(UIManager.getIcon("OptionPane.errorIcon")));
          contentPane.add(new JLabel(UIManager.getIcon("OptionPane.informationIcon")));
          contentPane.add(new JLabel(UIManager.getIcon("OptionPane.questionIcon")));
          contentPane.add(new JLabel(UIManager.getIcon("OptionPane.warningIcon")));
     }

     public static void main(String[] args){
          UIIcons mc = new UIIcons(args);
          mc.setSize(300,100);
          mc.setVisible(true);
     }
}
0
 

Author Comment

by:mbunkows
ID: 6403932
Perfect, thanks.
I don't know why I didn't catch that when I was looking at the source.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question