Java Swing Icon getDefaultIcon()

Here you can find the source of getDefaultIcon()

Description

get Default Icon

License

Open Source License

Declaration

private static Icon getDefaultIcon() 

Method Source Code

//package com.java2s;
/*/*from w w w  . j a v a2 s .c om*/
 IDEA PsiViewer Plugin
 Copyright (C) 2002 Andrew J. Armstrong

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 Author:
 Andrew J. Armstrong <andrew_armstrong@bigpond.com>
 */

import javax.swing.*;
import java.awt.*;
import java.awt.geom.GeneralPath;
import java.awt.image.BufferedImage;

public class Main {
    private static Icon getDefaultIcon() {
        BufferedImage bi = new BufferedImage(18, 18,
                BufferedImage.TYPE_INT_ARGB_PRE);
        Graphics2D g2 = bi.createGraphics();
        g2.setBackground(Color.red);
        g2.clearRect(0, 0, bi.getWidth(), bi.getHeight());
        g2.setColor(Color.white);
        g2.setStroke(new BasicStroke(2));
        GeneralPath x = new GeneralPath();
        x.moveTo(0, 0);
        x.lineTo(bi.getWidth() - 1, bi.getHeight() - 1);
        x.moveTo(0, bi.getHeight() - 1);
        x.lineTo(bi.getWidth() - 1, 0);
        g2.draw(x);
        return new ImageIcon(bi);
    }
}

Related

  1. getApplicationIcons()
  2. getBadgedIcon(Icon icon, Icon badge)
  3. getbtnIcon(String iconpath)
  4. getbtniconpresspress(String Iconpath1, String pressIconpath2, String pressIconpath3)
  5. getClosestIcon(Collection icons, int height)
  6. getDefaultIcon()
  7. getDefaultIcon()
  8. getEmptyIcon()
  9. getFolderIcon()