Methods Summary |
---|
public boolean | imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
if ((infoflags & ImageObserver.ERROR) != 0) {
System.out.println("Error loading image!");
System.exit(-1);
}
if ((infoflags & ImageObserver.WIDTH) != 0 &&
(infoflags & ImageObserver.HEIGHT) != 0)
rightSize();
if ((infoflags & ImageObserver.SOMEBITS) != 0)
repaint();
if ((infoflags & ImageObserver.ALLBITS) != 0) {
rightSize();
repaint();
return false;
}
return true;
|
public static void | main(java.lang.String[] args)
String url = "http://java.oreilly.com/" +
"news/knudsen/graphics/bite-size_banner.gif";
if (args.length > 0) url = args[0];
new RightSizer(new URL(url));
|
public void | paint(java.awt.Graphics g)
Insets insets = getInsets();
g.drawImage(mImage, insets.left, insets.top, this);
|
private void | rightSize()
int width = mImage.getWidth(this);
int height = mImage.getHeight(this);
if (width == -1 || height == -1) return;
addNotify();
Insets insets = getInsets();
setSize(width + insets.left + insets.right,
height + insets.top + insets.bottom);
center();
setVisible(true);
|
public void | update(java.awt.Graphics g)
paint(g);
|