Home Segments Top Top Previous Next

714: Mainline

Expecting that the Meter class will become a real meter, you should follow good programming practice by specifying an interface:

public interface MeterInterface { 
 // Setters: 
 public abstract void setValue (int valueToBeShownByDial) ; 
 public abstract void setTitle (String meterLabel) ; 
 // Getters: 
 public int getValueAtCoordinates (int x, int y) ; 
}  

The getValueAtCoordinates method is to return the value that would place the meter's dial nearest the given coordinates; it is put to use in Segment 780.