/** * Copyright (c): Uwe Schmidt, FH Wedel * * You may study, modify and distribute this source code * FOR NON-COMMERCIAL PURPOSES ONLY. * This copyright message has to remain unchanged. * * Note that this document is provided 'as is', * WITHOUT WARRANTY of any kind either expressed or implied. */ /* ein rot gruen Label * als event listener fuer * das eigene Ereignis */ import java.awt.Color; public class ViewColor extends ViewLabel { public ViewColor() { super(); setBackground(Color.green); } public void counterChanged(CounterChangedEvent e) { setBackground( e.cnt > 1 ? Color.green : e.cnt < -1 ? Color.red : Color.yellow ); } }