public class Punkt extends Button { public void set (boolean s) { ... Color c; if (s) { c = Color.darkGray; } else { c = Color.yellow; } setBackground (c); } }