W3R2 – Add Delete Functionality for your User Profile Data
This commit is contained in:
1 parent
5493aa2a0a
commit
4ba580a9ee
1 file changed
+14
-2
@@ -106,6 +106,7 @@ public class MainViewer {
|
||||
|
||||
ActionListener Deleter = e -> {
|
||||
System.out.println("Delete attempted for row: "+ row);
|
||||
rowDeleter(row);
|
||||
};
|
||||
JDelete.addActionListener(Deleter);
|
||||
|
||||
@@ -239,8 +240,19 @@ public class MainViewer {
|
||||
jr1.setSelected(j);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void rowDeleter(int row)
|
||||
{
|
||||
JPanel mainPane = (JPanel) viewer.getContentPane();
|
||||
JTabbedPane jt = (JTabbedPane) mainPane.getComponent(0);
|
||||
for (int i=0; i<3; i++) // 3 == the amount of tabs.
|
||||
{
|
||||
JPanel jp1 = (JPanel) jt.getComponentAt(i); // tab
|
||||
JPanel jp2 = (JPanel) jp1.getComponent(row-1); // row
|
||||
jp1.remove(jp2);
|
||||
jp1.repaint();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user