Boa tarde a todos!
Tenho a seguinte classe:
public class Tabela extends AbstractTableModel
{
public Tabela( String sql ){}
public Class getColumnClass( int coluna ) throws IllegalStateException
public int getColumnCount() throws IllegalStateException{}
public String getColumnName( int coluna ) throws IllegalStateException{}
public int getRowCount() throws IllegalStateException{}
public Object getValueAt( int linha, int coluna ) throws IllegalStateException{}
public void setQuery( String consulta ) throws SQLException, IllegalStateException{}
}
...
JTable t = new JTable( new Tabela(sql) );
add( new JScrollPane( t ), BorderLayout.CENTER );
...
Acontece que os registros, vindos da tabela do banco, são listados normalmente.
É possível ajustar a largura dos campos, para que toda vez que os registros
forem exibidos, não precisar alterar?
Por exemplo, o campo código, não precisa ser visualmente tão grande, quanto o campo observação!
Como definir isso?