Java Utililty Methods Image

List of utility methods to do Image

Description

The list of methods to do Image are organized into topic(s).

Method

ImageIcongetLogoImage()
Returns an ImageIcon of the logo (large image).
return getIcon("MEKA.png");
ImagegetManagedImage(Component source, String file, float tint, Color solid)
gets a managed image with the specified alpha tinting and all that jazz
if (!(new File(file)).exists()) {
    return null;
Image imageData = new javax.swing.ImageIcon(file).getImage();
if (tint > 0) {
    Image imageDataTinted = source.createImage(imageData.getWidth(null), imageData.getHeight(null));
    Graphics2D g2 = (Graphics2D) imageDataTinted.getGraphics();
    Composite oc = g2.getComposite();
...
JFileChoosergetNewImageFileChooser()
get New Image File Chooser
return getNewFileChooser(FILE_FILTER_TIFF, FILE_FILTER_PNG);
ImageIcongetOpenSwingImage(String name)
get Open Swing Image
return getOpenSwingImage(name, null);
ImagegetPanelImage(JPanel p)
I think it's more expensive to layout 1000 charts than it is to layout 1000 already rendered (fixed) images.
JFrame frame;
frame = new JFrame();
frame.setContentPane(p);
frame.pack();
Dimension size = p.getPreferredSize();
BufferedImage image = new BufferedImage((int) size.width, (int) size.height, BufferedImage.TYPE_INT_RGB);
p.paint(image.createGraphics());
return (image);
...
ImagegetScreenShareImage()
get Screen Share Image
Image image = new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("images/share.png"))
        .getImage().getScaledInstance(16, 16, Image.SCALE_AREA_AVERAGING);
return image;
ImagegetShieldImage()
get Shield Image
String path = new File(recordSheetPath).getAbsolutePath() + File.separatorChar;
Image image = new ImageIcon(path + "twbiped-shields.png").getImage();
return image;
ImagegetWindowImage(Window window)
get Window Image
try {
    if (window instanceof JFrame) {
        return ((JFrame) window).getIconImage();
    if (window instanceof JDialog) {
        return ((JDialog) window).getIconImages().get(0);
} catch (Exception e) {
...
ImageimageOf(Action action)
image Of
ImageIcon icon = (ImageIcon) action.getValue(AbstractAction.SMALL_ICON);
return icon == null ? null : icon.getImage();
IconinitVistaDragTextureImage()
Dynamically creates and returns drag texture icon
BufferedImage i = new BufferedImage(2, 2, BufferedImage.TYPE_INT_RGB);
int grey = new Color(124, 124, 124).getRGB();
i.setRGB(1, 0, grey);
i.setRGB(0, 1, grey);
i.setRGB(0, 0, new Color(162, 163, 164).getRGB());
i.setRGB(1, 1, new Color(107, 107, 107).getRGB());
return new ImageIcon(i);