IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Composants Java Discussion :

Java eclipse Onglet ets sous onglets


Sujet :

Composants Java

  1. #1
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Points : 96
    Points
    96
    Par défaut 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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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

  2. #2
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Points : 96
    Points
    96
    Par défaut
    Voici la capture d'écran :
    Nom : Capture.PNG
Affichages : 255
Taille : 32,2 Ko

  3. #3
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Points : 96
    Points
    96
    Par défaut
    pour info les onglets sont totalement inverser par rapport à l'ordre donné dans le code.

    Quelqu'un aurait une idée svp ???

  4. #4
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Points : 96
    Points
    96
    Par défaut
    c'était un problème de dimension de la tabHDMT :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    tabs = new JTabbedPane(SwingConstants.NORTH);
    tabHDMT = new TabHDMT();
    tabHDMT.setPreferredSize(new Dimension(600, 100));
    tabHDMT.setOpaque(true);
    Quelqu'un aurait une idée pour que ça taille s'adapte au nombre d'onglet automatiquement, comme un pack() par exemple car le setOpaque(true) ne change pas grand chose ?
    Merci bien

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. java eclipse : 2 onglets sur 6 posent problèmes
    Par nadong94 dans le forum Composants
    Réponses: 0
    Dernier message: 04/02/2016, 12h57
  2. onglets et sous onglets
    Par mathis86 dans le forum IHM
    Réponses: 2
    Dernier message: 13/09/2012, 11h21
  3. Onglet et sous onglets
    Par Marcel Chabot dans le forum Forms
    Réponses: 2
    Dernier message: 30/09/2010, 19h39
  4. Onglets et sous onglets Perl/Tk
    Par r9air dans le forum Interfaces Graphiques
    Réponses: 7
    Dernier message: 07/09/2010, 09h46
  5. Réponses: 0
    Dernier message: 23/04/2010, 19h04

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo