예제 #1
0
 void deleteButton_actionPerformed(ActionEvent e) {
   int row = table.getSelectedRow();
   if (row != -1) {
     String accountname = (String) usermodel.getValueAt(row, 0);
     usermodel.removeUser(accountname);
     usermodel.fireTableDataChanged();
   }
 }
예제 #2
0
  public AccountPanel() {
    try {
      jbInit();
    } catch (Exception e) {
      e.printStackTrace();
    }

    usermodel.addUser(new User("karl", "Karl Marx", ("rabid#communist").toCharArray()));
    usermodel.addUser(new User("vlad", "Vladimir Lenin", ("looney").toCharArray()));
    table = new JTable(usermodel);
    table.setPreferredScrollableViewportSize(new Dimension(28, 8));
    JScrollPane scrollpane = new JScrollPane(table);
    jPanelUsers.add(scrollpane);
  }