Java ImageIcon setDefaultImageIcons(Window window)

Here you can find the source of setDefaultImageIcons(Window window)

Description

set Default Image Icons

License

Open Source License

Declaration

public static void setDefaultImageIcons(Window window) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010 BSI Business Systems Integration AG.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors://  ww w  .  ja  v a  2s.c o  m
 *     BSI Business Systems Integration AG - initial API and implementation
 ******************************************************************************/

import java.awt.Image;

import java.awt.Window;

import java.util.ArrayList;

import java.util.List;

import javax.swing.Icon;
import javax.swing.ImageIcon;

import javax.swing.UIManager;

public class Main {
    public static void setDefaultImageIcons(Window window) {
        Icon icon = UIManager.getIcon("Window.icon");
        if (icon instanceof ImageIcon) {
            window.setIconImage(((ImageIcon) icon).getImage());
        }
        Object icons = UIManager.getDefaults().get("Window.icons");
        if (icons instanceof List<?>) {
            List<Image> iconList = new ArrayList<Image>();
            for (Object ico : ((List<?>) icons)) {
                if (ico instanceof Image) {
                    iconList.add((Image) ico);
                }
            }
            window.setIconImages(iconList);
        }
    }
}

Related

  1. makeDisabledImage(ImageIcon in)
  2. paintWithWatermarkHelper(JComponent component, ImageIcon watermark, Graphics g)
  3. parseImageIcon(Image image)
  4. prepareImage(ImageIcon icon, int x, int y)
  5. saveImage(ImageIcon picture, String targetfile)
  6. setImageIcon(ImageIcon icon, String description)
  7. setImageIcon(JLabel label, URL url)
  8. SetStandardSizeForImage(ImageIcon icon)
  9. setVerBumpIcon(ImageIcon icon)