The argument of a paint method is an instance of the Graphics
class:
import java.awt.*;
import javax.swing.*;
public class Meter extends JComponent implements MeterInterface {
String title = "Title to be Supplied";
int minValue, maxValue, value;
public Meter (int x, int y) {
minValue = x;
maxValue = y;
value = (y + x) / 2;
}
public void setValue(int v) {value = v; repaint();}
public void setTitle(String t) {title = t; repaint();}
// Getter to be defined
public void paint(Graphics g) {
...
}
}