public void itemStateChanged(ItemEvent e){
  String pName=(String)e.getItem();
  if (e.getStateChange() == ItemEvent.SELECTED) {
    this.printerName=pName;
  }
}

public void itemStateChanged ( ItemEvent e ) { String pName = ( String ) e . getItem ( ) ; if ( e . getStateChange ( ) == ItemEvent . SELECTED ) { this . printerName = pName ; } }
triggered when printer is changed
