Sunday, November 25, 2007

Java default icons

I always had the doubt, how to use java's icons? or wich are the default java's icons. for example the Warning icon from JOptionPane, etc.
This could be usefull or I want this because some time I need to use icon fast and easy to test something or just to don't add my own icon.

And now after to search for everywhere and looking inside Java's code i found some of them.

To get defaults icon, you need to ask to javax.swing.UIManager class, wich one have the objects related with look&fell (borders, icons, fonts...)

for example:

Icon icon = UIManager.getIcon("OptionPane.informationIcon");
JButton buton = new JButton(icon);



And the icon list is the next :


Icon
Key
QuestionIcon"OptionPane.questionIcon"
errorIcon"OptionPane.errorIcon"
informationIcon"OptionPane.informationIcon"
warningIcon"OptionPane.warningIcon"
directoryIcon"FileView.directoryIcon"
fileIcon"FileView.fileIcon"
computerIcon"FileView.computerIcon"
hardDriveIcon"FileView.hardDriveIcon"
floppyDriveIcon"FileView.floppyDriveIcon"
newFolderIcon"FileChooser.newFolderIcon"
upFolderIcon"FileChooser.upFolderIcon"
homeFolderIcon"FileChooser.homeFolderIcon"
detailsViewIcon"FileChooser.detailsViewIcon"
listViewIcon"FileChooser.listViewIcon"
expandedIcon"Tree.expandedIcon"
collapsedIcon"Tree.collapsedIcon"
openIcon"Tree.openIcon"
leafIcon"Tree.leafIcon"
closedIcon"Tree.closedIcon"

12 comments:

Anonymous said...

The icon set is too narrow to be very useful, but at least now I know it, so I stop wasting time on it. In 100Mb of Java code they could fit a dozen of decent icons though! :-) Thanks, bye

Anonymous said...

This is exactly what I needed thanks. Having the system look and feel is nice but not having your icons on buttons is annoying.

Anonymous said...

Thanks a lot, it's just what I am looking for!

Arfan said...

thank you very much

cravenraven1 said...
This comment has been removed by the author.
Anonymous said...

Useful, thank you.

Anonymous said...

Still useful brah! Thank you

Huyền Syn said...

One thing I want to talk to you is thank you. Your posts help me open my mind. I find them very interesting. They ease me in the hard time. Thanks for sharing your articles.
autoketing
sales pop master
sales pop master online

Huyền Syn said...

What do I say about your posts? I love them. I read them everyday and always wait for new ones. I am very happy because I have something interesting to read. Hope you can upload more and more.
y8 games
friv3play games
friv5 games

Huyền Syn said...

What do I say about your posts? I love them. I read them everyday and always wait for new ones. I am very happy because I have something interesting to read. Hope you can upload more and more.
zombs royale games online
happy wheels games online
five nights at freddys games online

Huyền Syn said...

What do I say about your posts? I love them. I read them everyday and always wait for new ones. I am very happy because I have something interesting to read. Hope you can upload more and more.
free brutalmaniaio
disney bridesmaids hair salon games to play
goalkeeper champ unblocked games

Huyền Syn said...

What do I say about your posts? I love them. I read them everyday and always wait for new ones. I am very happy because I have something interesting to read. Hope you can upload more and more.
adam and eve golf games for girls
pool 8 ball games to play
offroader v6 unblocked games