Thread: Chart Component
View Single Post
Old 02-26-2008, 01:15 PM   #3
lhurtado
Knows Where the Search Button Is
 
Join Date: Mar 2007
Location: Chile
Model: 8300
Carrier: Movistar Chile
Posts: 28
Default try this...

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(.....
    }
}
Offline   Reply With Quote