Here you can find the source of getPressedExitIcon(int x, int y)
public static ImageIcon getPressedExitIcon(int x, int y)
//package com.java2s; //License from project: Open Source License import java.awt.Dimension; import java.awt.Image; import javax.swing.ImageIcon; public class Main { private static ImageIcon PressedButton = null; private static ImageIcon PressedExit = null; private static final String IMAGE_FOLDER = "Images"; private static final String PRESSED_BUTTON_IMAGE = "/ButtonPressed.png"; private static final String PRESSED_EXIT_IMAGE = "/ExitButton2.png"; public static ImageIcon getPressedExitIcon(Dimension dim) { return getPressedButtonIcon(dim.width, dim.height); }/*from w w w .j ava2 s . com*/ public static ImageIcon getPressedExitIcon(int x, int y) { if (PressedExit == null) { PressedExit = new ImageIcon(IMAGE_FOLDER + PRESSED_EXIT_IMAGE); } return prepareImage(PressedExit, y, x); } public static ImageIcon getPressedButtonIcon(Dimension dim) { return getPressedButtonIcon(dim.width, dim.height); } public static ImageIcon getPressedButtonIcon(int x, int y) { if (PressedButton == null) { PressedButton = new ImageIcon(IMAGE_FOLDER + PRESSED_BUTTON_IMAGE); } return prepareImage(PressedButton, x, y); } private static ImageIcon prepareImage(ImageIcon icon, int x, int y) { Image img = icon.getImage(); Image newImg = img.getScaledInstance(x, y, java.awt.Image.SCALE_SMOOTH); return new ImageIcon(newImg); } }