Java GUI cheatsheet

swing mostly

JTable

public class CustomTableModel extends AbstractTableModel {
    public int getRowCount();
    public int getColumnCount();
    public Object getValueAt(int row, int column);
    //////
    public String getColumnName(int column);
}
 
// example of usage
CustomTableModel tmodel = new CustomTableModel();
JTable table = new JTable(tmodel);
public class CustomTableCellRenderer extends DefaultTableCellRenderer {
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                                                   boolean hasFocus, int row, int column) {
        Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
 
        // do your formating...
 
        return cell;
    }
 
// example of usage:
table.setDefaultRenderer(Object.class, new CustomTableCellRenderer());