private void fillResource(){
  KeyNamePair pp=(KeyNamePair)fieldResourceType.getSelectedItem();
  if (pp == null)   return;
  int S_ResourceType_ID=pp.getKey();
  KeyNamePair defaultValue=null;
  m_loading=true;
  fieldResource.removeAllItems();
  String sql="SELECT S_Resource_ID, Name FROM S_Resource WHERE IsActive='Y' AND S_ResourceType_ID=? ORDER BY 2";
  PreparedStatement pstmt=null;
  ResultSet rs=null;
  try {
    pstmt=DB.prepareStatement(sql,null);
    pstmt.setInt(1,S_ResourceType_ID);
    rs=pstmt.executeQuery();
    while (rs.next()) {
      pp=new KeyNamePair(rs.getInt(1),rs.getString(2));
      if (m_mAssignment.getS_Resource_ID() == pp.getKey())       defaultValue=pp;
      fieldResource.addItem(pp);
    }
  }
 catch (  SQLException e) {
    log.log(Level.SEVERE,sql,e);
  }
 finally {
    DB.close(rs,pstmt);
    rs=null;
    pstmt=null;
  }
  if (defaultValue != null)   fieldResource.setSelectedItem(defaultValue);
  m_loading=false;
}

private void fillResource ( ) { KeyNamePair pp = ( KeyNamePair ) fieldResourceType . getSelectedItem ( ) ; if ( pp == null ) return ; int S_ResourceType_ID = pp . getKey ( ) ; KeyNamePair defaultValue = null ; m_loading = true ; fieldResource . removeAllItems ( ) ; String sql = "SELECT S_Resource_ID, Name FROM S_Resource WHERE IsActive='Y' AND S_ResourceType_ID=? ORDER BY 2" ; PreparedStatement pstmt = null ; ResultSet rs = null ; try { pstmt = DB . prepareStatement ( sql , null ) ; pstmt . setInt ( 1 , S_ResourceType_ID ) ; rs = pstmt . executeQuery ( ) ; while ( rs . next ( ) ) { pp = new KeyNamePair ( rs . getInt ( 1 ) , rs . getString ( 2 ) ) ; if ( m_mAssignment . getS_Resource_ID ( ) == pp . getKey ( ) ) defaultValue = pp ; fieldResource . addItem ( pp ) ; } } catch ( SQLException e ) { log . log ( Level . SEVERE , sql , e ) ; } finally { DB . close ( rs , pstmt ) ; rs = null ; pstmt = null ; } if ( defaultValue != null ) fieldResource . setSelectedItem ( defaultValue ) ; m_loading = false ; }
fill resource pick from resource type
