Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6503914

RFE: stock icon/action support

    XMLWordPrintable

Details

    Description

      The GTK+ API offers the notion of "stock icons", which is basically
      a set of icons (provided by each theme) that are common to a
      majority of applications (basic things like OPEN, NEW, ZOOM_IN, etc):
      http://developer.gnome.org/doc/API/2.0/gtk/gtk-Stock-Items.html

      In addition to simply providing stock icons, GTK goes one step
      further and provides something called GtkStockItem, which
      includes a default label, mnemonic, and accelerator:
      http://developer.gnome.org/doc/API/2.0/gtk/gtk-Stock-Items.html#GtkStockItem

      The GtkIconTheme class provides a way to get a certain icon
      at a particular size (also allows for some control over
      whether it comes from an SVG file, but clearly this class
      ain't a paragon of design):
      http://developer.gnome.org/doc/API/2.0/gtk/GtkIconTheme.html

      If you want a "stock" button (or toolbar button, or menu item)
      you can use a method like gtk_button_new_from_stock(), which
      will give you a new GtkButton complete with the appropriately
      themed icon, localized text, and mnemonic:
      http://developer.gnome.org/doc/API/2.0/gtk/GtkButton.html#gtk-button-new-from-stock
      http://developer.gnome.org/doc/API/2.0/gtk/GtkToolButton.html#gtk-tool-button-new-from-stock
      http://developer.gnome.org/doc/API/2.0/gtk/GtkImageMenuItem.html#gtk-image-menu-item-new-from-stock

      It seems that GTK developers are quite comfortable using these
      APIs whenever possible; all of the apps I've played around
      with on Ubuntu have a consistent look because they're all
      picking up the same stock icons/text/mnemonics. Not
      surprisingly, Swing apps look very much out of place because
      they can't use that pool of stock widgets.

      In an ideal world, Swing would have a similar API. Each L&F
      could determine whether stock icons are used in buttons at
      all (e.g. for GTK and maybe Ocean this would be true, for
      Windows and Aqua this would be false). The downside of
      course is that if an app wants to look good ("fit in") on
      GTK, they'd have to update their code to use the new stock
      API in JDK 7, but no matter what, developers would have to
      update their apps anyway. The upside is that it would offer
      a pretty easy solution for developers who want their apps to
      look more native; better to give them an easy approach, because
      otherwise it's clear that Joe Developer ain't doing it himself the hard way.

      Note that this isn't just about the GTK L&F. The Windows L&F
      should be able to provide access to at least some common icons
      via the uxTheme APIs. It is expected that Apple will provide
      access to a set of common icons in their upcoming Leopard release,
      but details are sketchy. We (Sun) should provide a set of
      high-quality icons that can be used with Metal/Ocean, or as a
      backup for L&Fs that aren't yet updated to provide ones of
      their own. (This last idea would be really nice because most
      developers have to scour the web looking for free icons, or spend
      lots of time implementating their own.)

      Attachments

        Activity

          People

            alexp Alexander Potochkin (Inactive)
            campbell Christopher Campbell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: