자바 실습 수정

private void jBtn1ActionPerformed(java.awt.event.ActionEvent evt) {                                       
        // TODO add your handling code here: 
        //VECTOR 
         
        this.memVec.add(addMember(jNameTxt.getText(), jNumTxt.getText())); 
        this.pack(); 
         
        System.out.println(memVec); 
        display(1); 
    }                                      
 
    private void jBtn2ActionPerformed(java.awt.event.ActionEvent evt) {                                       
        // TODO add your handling code here: 
        for(int i = 0; i < ary.length; i++) { 
            if(ary[i] == null) { 
                ary[i] = addMember(jNameTxt.getText(), jNumTxt.getText()); 
                break; 
            } 
        } 
        display(2); 
         
    }    
 
 
private void display(int flag) { 
      jDisplayPanel.removeAll(); 
      jDisplayPanel.repaint(); 
        if(flag == 1) { 
            int size = memVec.size(); 
            for(int i = 0; i < size; i++) { 
                Member mem = (Member)memVec.get(i); 
                jDisplayPanel.add(new JButton(mem.getName())); 
                 
            } 
        } 
        else { 
            for(int i = 0; i < ary.length; i++) { 
                if(ary[i] != null) { 
                    jDisplayPanel.add(new JButton(ary[i].getName())); 
                } 
                 
                else 
                    continue; 
            } 
        } 
        this.pack(); 
    } 
     
    private Member addMember(String name, String number) { 
        Member newMember = new Member(name, number); 
         
        JButton newBtn = new JButton(name); 
         
        this.jDisplayPanel.add(newBtn); 
         
        return newMember; 
    }