Load an Icon from a jar : ImageIcon « 2D Graphics « Java Tutorial






import javax.swing.Icon;
import javax.swing.UIManager;

public class Main {
  public static void main(String[] argv) throws Exception {
  }

  public static Icon getIconForType(int iconType) {
    switch (iconType) {
    case 0:
      return UIManager.getIcon("OptionPane.errorIcon");
    case 1:
      return UIManager.getIcon("OptionPane.informationIcon");
    case 2:
      return UIManager.getIcon("OptionPane.warningIcon");
    case 3:
      return UIManager.getIcon("OptionPane.questionIcon");
    }
    return null;
  }
}








16.32.ImageIcon
16.32.1.Load image to ImageIcon and add it to Panel
16.32.2.Load an Icon from a jar
16.32.3.Convert a non-RGB image to an RGB buffered image:
16.32.4.Return a filled oval as an Icon
16.32.5.Change JFrame image icon
16.32.6.A button which paints on it one or more scaled arrows in one of the cardinal directions
16.32.7.RGB Gray Filter