Boa Tarde Companheiros,
Estou inserindo uma Jtable num JTabbedPane porém está sumindo o nome dos Campos ...
Uma outra dúvida é encaixar a Tabela conforme tamanho do JPanel ...
Aonde eu vejo o tamanho do meu JPanel no NetBeans? Entro em Propriedades mas não encontro ... eu o crio arrastando ....
Segue Código:
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
public class Abas extends JFrame {
public static void main(String[] args) {
Abas tab = new Abas();
tab.setVisible(true);
}
public Abas() {
super();
getContentPane().setLayout(null);
this.setSize(500,500);
this.setLocationRelativeTo(null);
this.setTitle("Testando eventos das abas");
this.setResizable(false);
final JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.setBounds(0, 0, 502, 371);
getContentPane().add(tabbedPane);
final JPanel panel = new JPanel();
panel.setLayout(null);
tabbedPane.addTab("Tab 1", null, panel, null);
String data[][] = {{"John", "Sutherland", "Student"},
{"George", "Davies", "Student"},
{"Melissa", "Anderson", "Associate"},
{"Stergios", "Maglaras", "Developer"},
};
String fields[] = {"Name", "Surname", "Status"};
final JTable tabela = new JTable(data,fields);
JScrollPane pane = new JScrollPane( tabela );
this.add( pane );
tabela.setBounds(0, 0, 480, 350);
panel.add(tabela);
final JPanel panel_1 = new JPanel();
panel_1.setLayout(null);
tabbedPane.addTab("Tab 2", null, panel_1, null);
final JCheckBox checkBox = new JCheckBox();
checkBox.setBounds(170, 130, 118, 24);
checkBox.setText("New JCheckBox");
panel_1.add(checkBox);
final JPanel panel_2 = new JPanel();
panel_2.setLayout(null);
tabbedPane.addTab("Tab 3", null, panel_2, null);
final JRadioButton radioButton = new JRadioButton();
radioButton.setText("New JRadioButton");
radioButton.setBounds(180, 141, 129, 24);
panel_2.add(radioButton);
}
}
Desde já agradeço!