Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 25-10-2008
Member
 
Join Date: Oct 2008
Posts: 37
Which default icons are available

I try to create a simple JButton with an arrow icon that shall look the same as the arrow buttons in for instance the JScrollPane and JComboBox.

I've found something like UIManager.getIcon( "Some icon string" ) but which icon strings are available to me? Is this the right way to copy the look of another component?
Reply With Quote
  #2  
Old 25-10-2008
Member
 
Join Date: May 2008
Posts: 2,383
Re: Which default icons are available

This is not documented anywhere. In general, there is no reliable API to get internal icons, especially not in a PLAF-independent way. You can get the UIDefaults via the UIManager and print all the defaults (it is a Map). There is e.g. a small tool called ShowUIDefaults.java out there doing this with a GUI.

This list will contain among other things the icon key/value pairs, so you will see which ones are available for the current PLAF. But another PLAF or another VM implementation might provide a completely different set of icons, or no icons at all.

If you want to deal with Metal only, you can use javax.swing.plaf.metal.MetalIconFactory to get Metal-Related icons. This is at least a public API, although not a really good one. You could also snoop round in the javax.swing.plaf.basic.BasicIconFactory for some more icons.
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #3  
Old 25-10-2008
Member
 
Join Date: Oct 2008
Posts: 37
Re: Which default icons are available

Ok, thanks. I'll check that out.
Reply With Quote
  #4  
Old 25-10-2008
Member
 
Join Date: May 2008
Posts: 2,293
Re: Which default icons are available

This page (http://forums.sun.com/thread.jspa?threadID=5338038) has some code sample that shows the default values for a given theme, thus teling which icon strings it supports.

For the Nimbus look and feel, I got this info:
Tree.collapsedIcon
FileChooser.directoryIcon
FileChooser.detailsViewIcon
OptionPane.questionIcon
FileChooser.newFolderIcon
FileView.floppyDriveIcon
Tree.openIcon
Tree.expandedIcon
OptionPane.informationIcon
Tree.closedIcon
Tree.leafIcon
FileChooser.upFolderIcon
OptionPane.errorIcon
ToolBar.handleIcon
FileChooser.floppyDriveIcon
FileChooser.fileIcon
RadioButton.icon
FileView.fileIcon

Haven't tested all values though.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Which default icons are available"
Thread Thread Starter Forum Replies Last Post
Not able to Locate Default Icons Obessed Windows Software 3 10-11-2010 07:01 AM
Making medium icons the default style Esmel Windows Software 6 10-09-2010 10:46 PM
Java program to remove JTree default icons? Baazigar Software Development 4 22-01-2010 07:35 PM
How to change Vista default folder icons? Abhav Customize Desktop 4 17-06-2009 05:58 AM
Restore Windows Default Icons ChrisUlrich Customize Desktop 2 25-03-2009 01:55 PM


All times are GMT +5.5. The time now is 12:15 PM.