Java Swing - 如何處理JTabbedPane中選項(xiàng)卡標(biāo)題的高度...
我們想知道如何處理JTabbedPane中選項(xiàng)卡標(biāo)題的高度。...
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.border.TitledBorder;
public class Main {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(), "Table Title", TitledBorder.CENTER,
TitledBorder.TOP));
JTable table = new JTable(3, 3);
panel.add(new JScrollPane(table));
frame.add(panel);
frame.pack();
frame.setVisible(true);
}
}