List of usage examples for java.awt MediaTracker waitForAll
public void waitForAll() throws InterruptedException
From source file:Main.java
ImagePanel() { MediaTracker mt = new MediaTracker(this); for (int i = 0; i < images.length; i++) { imgs[i] = Toolkit.getDefaultToolkit().getImage(images[i]); mt.addImage(imgs[i], i);/*from w ww . j a v a 2 s . com*/ } try { mt.waitForAll(); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:ConvolveApp.java
public void loadImage() { displayImage = Toolkit.getDefaultToolkit().getImage("largeJava2sLogo.jpg"); MediaTracker mt = new MediaTracker(this); mt.addImage(displayImage, 1);//w w w . j a v a2 s . c o m try { mt.waitForAll(); } catch (Exception e) { System.out.println("Exception while loading."); } if (displayImage.getWidth(this) == -1) { System.out.println("No jpg file"); System.exit(0); } }
From source file:MainClass.java
public void init() { i = getImage(getDocumentBase(), "rosey.jpg"); MediaTracker mt = new MediaTracker(this); mt.addImage(i, 0);/* w w w.j a v a 2s .co m*/ try { mt.waitForAll(); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Loaded"); j = createImage(new FilteredImageSource(i.getSource(), new BlurFilter())); System.out.println("Created"); }
From source file:MainClass.java
public void init() { MediaTracker mt = new MediaTracker(this); i = getImage(getDocumentBase(), "ora-icon.gif"); mt.addImage(i, 0);/*from ww w .j a v a 2s . c o m*/ try { mt.waitForAll(); int width = i.getWidth(this); int height = i.getHeight(this); int pixels[] = new int[width * height]; PixelGrabber pg = new PixelGrabber(i, 0, 0, width, height, pixels, 0, width); if (pg.grabPixels() && ((pg.status() & ImageObserver.ALLBITS) != 0)) { j = createImage( new MemoryImageSource(width, height, rowFlipPixels(pixels, width, height), 0, width)); k = createImage( new MemoryImageSource(width, height, colFlipPixels(pixels, width, height), 0, width)); l = createImage( new MemoryImageSource(height, width, rot90Pixels(pixels, width, height), 0, height)); } } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:BufferedImageThread.java
AnimationCanvas() { setBackground(Color.green);//from ww w . ja v a 2s . c om setSize(450, 400); image = getToolkit().getImage("largeJava2sLogo.gif"); MediaTracker mt = new MediaTracker(this); mt.addImage(image, 1); try { mt.waitForAll(); } catch (Exception e) { System.out.println("Exception while loading image."); } if (image.getWidth(this) == -1) { System.out.println("No gif file"); System.exit(0); } rotate = (int) (Math.random() * 360); scale = Math.random() * 1.5; scaleDirection = DOWN; xi = 50.0; yi = 50.0; }
From source file:AffineTransformApp.java
public void loadImage() { displayImage = Toolkit.getDefaultToolkit().getImage("largeJava2sLogo.jpg"); MediaTracker mt = new MediaTracker(this); mt.addImage(displayImage, 1);// w w w. ja v a 2 s. c o m try { mt.waitForAll(); } catch (Exception e) { System.out.println("Exception while loading."); } if (displayImage.getWidth(this) == -1) { System.out.println(" Missing .jpg file"); System.exit(0); } }
From source file:CombineApp.java
public void loadImage() { displayImage = Toolkit.getDefaultToolkit().getImage("largeJava2sLogo.jpg"); MediaTracker mt = new MediaTracker(this); mt.addImage(displayImage, 1);//w w w. java 2 s . c om try { mt.waitForAll(); } catch (Exception e) { System.out.println("Exception while loading."); } if (displayImage.getWidth(this) == -1) { System.out.println("No jpg) file"); System.exit(0); } }
From source file:Java2DExample.java
public ImagePanel(URL imageURL) { image = Toolkit.getDefaultToolkit().createImage(imageURL); MediaTracker mediaTracker = new MediaTracker(this); mediaTracker.addImage(image, 0);/*from www .jav a 2 s. c om*/ try { mediaTracker.waitForAll(); } catch (InterruptedException e) { e.printStackTrace(); } originalImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB); displayImage = originalImage; Graphics2D graphics = displayImage.createGraphics(); graphics.drawImage(image, null, null); }
From source file:ColorApp.java
public void loadImage() { displayImage = Toolkit.getDefaultToolkit().getImage("largeJava2sLogo.jpg"); MediaTracker mt = new MediaTracker(this); mt.addImage(displayImage, 1);//from w ww .j av a 2s.co m try { mt.waitForAll(); } catch (Exception e) { System.out.println("Exception while loading."); } if (displayImage.getWidth(this) == -1) { System.out.println("No jpg file"); System.exit(0); } }
From source file:ColorApp.java
public void loadImage() { displayImage = Toolkit.getDefaultToolkit().getImage("a.jpg"); MediaTracker mt = new MediaTracker(this); mt.addImage(displayImage, 1);/* ww w . j a v a 2 s .c o m*/ try { mt.waitForAll(); } catch (Exception e) { System.out.println("Exception while loading."); } if (displayImage.getWidth(this) == -1) { System.out.println("No jpg file"); System.exit(0); } }