Title: Java jGrasp - DynamicTable
Duration: 16:07 min
Description: In this video I extend the discussion on tables by creating a table the inherits the functionalities of the AbstractTableModel. The table slots will be filled using the formula Math.pow(r,c) where r is the row and c is the column. When inheriting from AbstractTableModel, there are three methods that we need to implement: getColumnCount(), getRowCount(), and getValueAt() which returns an Object. You can format this object any way you see fit. Then finally, we added a method getColumnName(). By default java displays letters for column names (A, B, C...). We overrode this method and returned R^c, where c is the column number.
Methodology: Good coding standards and simplified design.
Technologies: Abstract Window Toolkit, Java Swing.
Examples constructed: created an example that extends the functionality available in the AbstractTableModel class. This class allows us to set the column count, row count, value in every slot in the table, and the column names. We were able to use the Math.pow() method to populate the table.
Key words: AWT, Swing, JFrame, JTable, AbstractTableModel, EventQueue, Runnable.