Code:
class BarGraph extends Field implements DrawStyle{
private int fieldWidth;
private int fieldHeight;
public BarGraph(){
fieldHeight = 100;
fieldWidth = Graphics.getScreenWidth();
}
protected void layout(int width, int height) {
setExtent(getPreferredWidth(), getPreferredHeight());
}
public int getPreferredWidth() {
return fieldWidth;
}
public int getPreferredHeight() {
return fieldHeight;
}
protected void paint(Graphics graphics) {
//here draw your graph...
graphics.setColor(Color.BLACK);
graphics.drawLine(.....
}
}