Java eclipse Onglet ets sous onglets
Bonjour à tous,
J'ai un petit problème d'affichage pour mes sous onglets.
D'abord j'ai un onglets HDMT qui contient plusieurs sous onglets, et ceux-ci se mets les uns au dessous des autres.
Voici la classe tabHDMT :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
package HDMT;
import javax.swing.JTabbedPane;
/**
* HDMT tab that recover all sub tabHDMT that suits him
* @author t0163126
*/
public class TabHDMT extends JTabbedPane
{
private static final long serialVersionUID = 1L;
private static ConnectivityDefinition tabConnectivityDefinition;
private static LogicalPortAllocation tabLogicalPortAllocation;
private static IPDefinition tabIPDefinition;
private static ConfigPatchIdDefinition tabConfigPatchIdDefinition;
//============================================================
//constructor
private TabHDMT()
{
initTabHDMT();
}
//Method initialization
private void initTabHDMT()
{
//Window event
//this.addWindowListener(new MonWindowAdapter(this));
tabConnectivityDefinition = new ConnectivityDefinition();
tabLogicalPortAllocation = new LogicalPortAllocation();
tabIPDefinition = new IPDefinition();
tabConfigPatchIdDefinition = new ConfigPatchIdDefinition();
this.addTab("Connectivity Definition",tabConnectivityDefinition);
this.addTab("Logical Port Allocation",tabLogicalPortAllocation);
this.addTab("IP Definition",tabIPDefinition);
this.addTab("Config Patch Id Definition",tabConfigPatchIdDefinition);
this.setOpaque(true);
}
//============================================================
//instenciation
private static TabHDMT hdmt;
public static TabHDMT getInstance()
{
if (hdmt == null) {
hdmt = new TabHDMT();
}
return hdmt;
}
//============================================================
//Getter and setter
public static ConnectivityDefinition getTabConnectivityDefinition() {
return tabConnectivityDefinition;
}
public static LogicalPortAllocation getTabLogicalPortAllocation() {
return tabLogicalPortAllocation;
}
public static IPDefinition getTabIPDefinition() {
return tabIPDefinition;
}
public static ConfigPatchIdDefinition getTabConfigPatchIdDefinition() {
return tabConfigPatchIdDefinition;
}
public static ConnectivityDefinition getConnectivityDefinition() {
return tabConnectivityDefinition;
}
public static LogicalPortAllocation getLogicalPortAllocation() {
return tabLogicalPortAllocation;
}
public static IPDefinition getIPDefinition() {
return tabIPDefinition;
}
public static ConfigPatchIdDefinition getConfigPatchIdDefinition() {
return tabConfigPatchIdDefinition;
}
} |
et la classe qui va récupérer l'onglet tabHDMT :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
package IHM;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingConstants;
import HDMT.TabHDMT;
/**
* IHM of Converter application
* @author t0163126
*/
public class IhmConverter extends JFrame
{
private static final long serialVersionUID = 1L;
private static MyToolBar myToolBar;
private static TabHDMT tabHDMT;
private static JTabbedPane tabs;
private JPanel panCustomer;
private JPanel panHeader;
//============================================================
//constructorr
private IhmConverter()
{
initIhmConverter();
}
//Method initialization
private void initIhmConverter()
{
//window event
//this.addWindowListener(new MonWindowAdapter(this));
tabs = new JTabbedPane(SwingConstants.NORTH);
tabHDMT = TabHDMT.getInstance();
tabs.addTab("HDMT",tabHDMT);
tabs.setOpaque(true);
panHeader = new JPanel();
panHeader.setLayout(new FlowLayout());
panHeader.add(tabs);
//Customer area
panCustomer = (JPanel) this.getContentPane();
panCustomer.setLayout(new BorderLayout());
panCustomer.add(panHeader, BorderLayout.NORTH);
//Add myToolBar
myToolBar = new MyToolBar();
//this.setJMenuBar(myToolBar);
}
//============================================================
//instenciation
private static IhmConverter hdmt;
public static IhmConverter getInstance()
{
if (hdmt == null) {
hdmt = new IhmConverter();
}
return hdmt;
}
//============================================================
//Getter and setter
public static JTabbedPane getTabs() {
return tabs;
}
public static MyToolBar getmyToolBar() {
return myToolBar;
}
} |
Merci d'avance pour vos éclaircissements :)