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"

10 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!

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

Useful, thank you.

Anonymous said...

Still useful brah! Thank you

Huyen 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

Huyen 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


boymaichoi17 said...

Somebody essentially help to make seriously articles I’d state. This is the very first time I frequented your website page and thus far? I amazed with the analysis you made to make this particular post amazing. Fantastic job!
kizi unblocked
Jogos 2019
friv school Games to play

Alessio Moraschini said...

Very helpful, Thank you!! This is what I was looking for :)