/** Create a new MLED from the given delegate */ public MLED(ControlDelegate delegate) { super(); this.delegate = delegate; delegate.setOwner(this); setBounds(delegate.getCtrlDef().targetBounds.getRectangle()); setOpaque(true); }
/** * return a string representation of this MControl by including the control's type and name as * specified in the skin definition file. */ @Override public String toString() { if (delegate != null && delegate.getCtrlDef() != null) { return delegate.getCtrlDef().fullName + ": " + super.toString(); } return super.toString(); }
/** return if this LED is lit */ public boolean isSelected() { return delegate.isDown(); }
/** light up this LED */ public void setSelected(boolean on) { if (delegate.isDown() != on) { delegate.setDown(on); repaint(); } }
@Override public Dimension getMaximumSize() { return delegate.getMaximumSize(); }
@Override public Dimension getPreferredSize() { return delegate.getPreferredSize(); }
@Override public void paint(Graphics g) { delegate.paint(g); }