Here you can find the source of getPressedButtonIcon(int x, int y)
public static ImageIcon getPressedButtonIcon(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 final String IMAGE_FOLDER = "Images"; private static final String PRESSED_BUTTON_IMAGE = "/ButtonPressed.png"; public static ImageIcon getPressedButtonIcon(Dimension dim) { return getPressedButtonIcon(dim.width, dim.height); }/* www . j a va2 s.c o m*/ 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); } }