public CookiePanel() { try { jbInit(); } catch (Exception e) { e.printStackTrace(); } buttonGroupDefault.add(jRadioButtonDefaultAccept); buttonGroupDefault.add(jRadioButtonDefaultAsk); buttonGroupDefault.add(jRadioButtonDefaultReject); buttonGroupDomain.add(jRadioButtonDomainAccept); buttonGroupDomain.add(jRadioButtonDomainAsk); buttonGroupDomain.add(jRadioButtonDomainReject); Object[][] cells = { {"java.sun.com", "accept"}, {"amazon.com", "ask"}, {"evil.hacker.org", "deny"}, {"microsoft.com", "deny"}, {"ibm.com", "ask"}, {"oracle.com", "accept"}, {"netscape.com", "accept"}, {"borland.com", "accept"}, {"rsasecurity.com", "accept"}, {"linux.org", "accept"}, {"redhat.com", "accept"}, {"linuxjournal.com", "accept"}, {"bea.com", "accept"}, {"sick.perverts.org", "deny"} }; String[] columnNames = {"Domain", "Policy"}; JTable table = new JTable(cells, columnNames); JScrollPane scrollpane = new JScrollPane(table); table.setPreferredScrollableViewportSize(new Dimension(28, 10)); jPanelDomainSpecific.add(scrollpane); }
void deleteButton_actionPerformed(ActionEvent e) { int row = table.getSelectedRow(); if (row != -1) { String accountname = (String) usermodel.getValueAt(row, 0); usermodel.removeUser(accountname); usermodel.fireTableDataChanged(); } }
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); }