Certifique-se que sua tabela está dentro de um JScrollPane (só com ele as colunas são exibidas);
2.[size=18] [color=red]Não use DefaultTableModel.[/color][/size]
M
Mvrback
O código completo.
ListlistaDB=newListarGrid().selecionar();String[]colunas=newString[]{"Nome","Data","Cidade","CPF"};String[][]dados=newString[listaDB.size()][4];ListarGrid1myList=null;for(inti=0;i<listaDB.size();i++){myList=(ListarGrid1)listaDB.get(i);dados[i][0]=myList.getNome();dados[i][1]=myList.getData().toString();dados[i][2]=myList.getCidade();dados[i][3]=myList.getCpf();}DefaultTableModelmodelo=newDefaultTableModel(dados,colunas);JTabletable1=newJTable(modelo);setDefaultCloseOperation(DISPOSE_ON_CLOSE);setSize(900,500);//Tamanho da tela xysetLocationRelativeTo(null);JToolBartoolBar=newJToolBar();toolBar.add(newJButton("BDII"));add(toolBar,BorderLayout.PAGE_START);PanelpanelPrincipal=newPanel();panelPrincipal.setLayout(newGridBagLayout());GridBagConstraintsgbc=newGridBagConstraints();JPanelpanelBotões=newJPanel();panelPrincipal.add(panelBotões,gbc);add(panelPrincipal);add(table1);this.show();
ViniGodoy
Como eu falei, coloque o seu JTable dentro de um JScrollPane. Ou seja, troque:
add(table1);
Por:
add(newJScrollPane(table1));
[size=24][color=red]E não use o DefaultTableModel. [/color][/size]