FileDocCategorySizeDatePackage
OvalIcon.javaAPI DocExample460Thu Oct 24 20:14:20 BST 2002None

OvalIcon.java

// OvalIcon.java
// A simple icon implementation that draws ovals.
//
import javax.swing.*;
import java.awt.*;

public class OvalIcon implements Icon {

  private int width, height;

  public OvalIcon(int w, int h) {
    width = w;
    height = h;
  }

  public void paintIcon(Component c, Graphics g, int x, int y) {
    g.drawOval(x, y, width-1, height-1);
  }

  public int getIconWidth() { return width; }
  public int getIconHeight() { return height; }
}