public LinkIcon(boolean linked){
  this.linked=linked;
  link=linked ? linkedImIc.getImage() : unlinkedImIc.getImage();
  addMouseListener(this);
  Dimension dim=new Dimension((int)link.getWidth(null),link.getHeight(null));
  setPreferredSize(dim);
  setMinimumSize(dim);
  setMaximumSize(dim);
  setSize(dim);
  setLayout(null);
  repaint();
}

public LinkIcon ( boolean linked ) { this . linked = linked ; link = linked ? linkedImIc . getImage ( ) : unlinkedImIc . getImage ( ) ; addMouseListener ( this ) ; Dimension dim = new Dimension ( ( int ) link . getWidth ( null ) , link . getHeight ( null ) ) ; setPreferredSize ( dim ) ; setMinimumSize ( dim ) ; setMaximumSize ( dim ) ; setSize ( dim ) ; setLayout ( null ) ; repaint ( ) ; }
create a lock icon either in the locked or unlocked state .
