List of usage examples for java.awt Image getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:Main.java
public static BufferedImage toBufferedImageUnchecked(Image awtImage) { Method getBufferedImage = null; try {/* w w w . j a v a 2s . c o m*/ getBufferedImage = awtImage.getClass().getMethod("getBufferedImage"); } catch (NoSuchMethodException | SecurityException e) { throw new RuntimeException(e); } BufferedImage bufferedImage = null; try { bufferedImage = (BufferedImage) getBufferedImage.invoke(awtImage); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); } return bufferedImage; }