我想创建一个JTabbedPane
,但是我想手动创建标题,我创建了一个JPanel
和JLabel
,在其中放置了Icon
和背景色,但是我不知道如何添加它到选项卡式窗格。
选项卡式窗格有4个面板:
JPanel header = new JPanel();
header.setSize(100, 50);
header.setBackground(Color.red);
JLabel icon_Label = new JLabel(Icon);
icon_Label.setText("header 1");
jTabbedPane1.getComponentAt(1).*************?!
我找到它
JPanel panel = new JPanel();
panel.setBackground(Color.BLUE);
JLabel title = new JLabel("OK");
title.setForeground(Color.RED);
title.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/icons8-boîte-pleine-64.png")));
title.setText("GESTION A");
panel.add(title);
jTabbedPane1.setTabComponentAt(2, panel);