Delete a selected row in JTable with a custom model

DefaultTableModel model = (DefaultTableModel) myTable.getModel(); //Get reference to model model.removeRow(x); //Remove row x You can also add a method deleteRow(int row) to your custom model class code as in: public class MyTableModel extends AbstractModel { private Vector dataVector = new Vector(); String[] columnNames = {"First Name", "Last Name", "Age"}; public int getRowCount() { if (dataVector.size() … Continue reading Delete a selected row in JTable with a custom model

Delete all rows from a Java JTable with a custom TableModel

I want to clear all rows in a custom TableModel. Unfortunately, a custom TableModel in Java does not allow use of most efficient of row clearing methods, which only applies to a DefaultTableModel like that shown below: myTableModel.getDataVector().removeAllElements(); myTableModel.fireTableDataChanged(); To do an all clear like the above, for a custom TableModel, you need to reset … Continue reading Delete all rows from a Java JTable with a custom TableModel

UML Diagrammer / Class Generator Tool on Linux

Astah Community Edition Today's object oriented languages require extensive use of objects, their inter-relationships and methods. There are several UML tools out there like UMlet, Umbrello on Linux, but this one from astah stands out. You can try the community edition before deciding to purchase a full version. It enables the creation of objects, building … Continue reading UML Diagrammer / Class Generator Tool on Linux

Head First Java – Learn Java the fun way

After many years of trying to learn Java from a good book, I finally got down to learning it from "Head First Java". The authors have done a great job explaining programming concepts, object oriented programming concepts and Java in a fun way. All the investments made thus far, in other books were just that... … Continue reading Head First Java – Learn Java the fun way