Which default icons are available?

Discussion in 'Java' started by DeMarcus, Nov 15, 2004.

  1. DeMarcus

    DeMarcus Guest

    Hi,

    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?

    Thanks
    Daniel
     
    DeMarcus, Nov 15, 2004
    #1
    1. Advertising

  2. DeMarcus wrote:
    > I've found something like UIManager.getIcon( "Some icon string" )
    > but which icon strings are available to me?


    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.

    /Thomas
     
    Thomas Weidenfeller, Nov 15, 2004
    #2
    1. Advertising

  3. DeMarcus

    DeMarcus Guest

    Thomas Weidenfeller wrote:

    > DeMarcus wrote:
    >
    >> I've found something like UIManager.getIcon( "Some icon string" )
    >> but which icon strings are available to me?

    >
    >
    > 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.
    >
    > /Thomas


    Ok, thanks. I'll check that out.

    /Daniel
     
    DeMarcus, Nov 15, 2004
    #3
  4. DeMarcus

    facildelembrar

    Joined:
    Oct 17, 2008
    Messages:
    2
    More info

    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.
     
    facildelembrar, Oct 17, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ignasi Giró

    Howto create a popup menu with icons?

    Ignasi Giró, Aug 29, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    722
    Ignasi Giró
    Aug 30, 2005
  2. CodeMonkey
    Replies:
    0
    Views:
    430
    CodeMonkey
    Oct 11, 2005
  3. Heiko Will

    How to get OS Icons

    Heiko Will, Jun 25, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    880
    Heiko Will
    Jun 25, 2003
  4. Richie Williams
    Replies:
    5
    Views:
    1,566
    Richie Williams
    Oct 25, 2007
  5. Raistlin Majere
    Replies:
    2
    Views:
    109
    Raistlin Majere
    May 19, 2007
Loading...

Share This Page