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

Agents de placement/Fenêtres Java Discussion :

Component Z order


Sujet :

Agents de placement/Fenêtres Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre actif
    Avatar de Grumphette
    Homme Profil pro
    Validation manager
    Inscrit en
    Juillet 2008
    Messages
    81
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Validation manager

    Informations forums :
    Inscription : Juillet 2008
    Messages : 81
    Par défaut Component Z order
    Bonjour,

    Voila j'ai des Panels mais j'aimerai spécifier un ordre d'affichage, j ai pensé à ComponentZorder, mais je ne trouve pas de Tuto ou d'exemple. Si vous pouviez eclairer ma lanterne?

    Merci d'avance

  2. #2
    Expert confirmé
    Avatar de sinok
    Profil pro
    Inscrit en
    Août 2004
    Messages
    8 765
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Août 2004
    Messages : 8 765
    Par défaut
    Sinon tu as le CardLayout, c'est pas mal dans ce genre de situations

  3. #3
    Membre Expert
    Avatar de natha
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    2 346
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Janvier 2006
    Messages : 2 346
    Par défaut
    JLayeredPane aussi.

  4. #4
    Membre actif
    Avatar de Grumphette
    Homme Profil pro
    Validation manager
    Inscrit en
    Juillet 2008
    Messages
    81
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Validation manager

    Informations forums :
    Inscription : Juillet 2008
    Messages : 81
    Par défaut
    En fait j 'ai

    ---------------------------------------------
    **********Panel Fixe*****************
    ---------------------------------------------
    ***********************************
    ***********************************
    *********Panel avec une scroll barre******
    ***********************************
    ***********************************
    ---------------------------------------------

    Les textboxs passe bien sous le Panel fixe, alors que les labels non. Pourquoi?

  5. #5
    Membre Expert
    Avatar de CheryBen
    Inscrit en
    Mai 2005
    Messages
    1 599
    Détails du profil
    Informations personnelles :
    Âge : 43

    Informations forums :
    Inscription : Mai 2005
    Messages : 1 599
    Par défaut
    Difficile à dire sans voir ton code, quel layout as-tu utilisé? comment ajoutes-tu tes composants? dans quel ordre?

    Tu trouveras un référencement des layouts dans ce sujet : http://www.developpez.net/forums/sho...d.php?t=528316

  6. #6
    Membre actif
    Avatar de Grumphette
    Homme Profil pro
    Validation manager
    Inscrit en
    Juillet 2008
    Messages
    81
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Validation manager

    Informations forums :
    Inscription : Juillet 2008
    Messages : 81
    Par défaut
    Voila,mon application a pour but d'aller lire dans un fichier exel des informations, et de les afficher.

    Pour l'affichage, j'ai comme affiché au dessus, un panel fixe en haut et bas de ma fenetre. Au centre j'ai un ScrollPane dans lequel j'affiche les infos.

    Dans ce scroll pane j ai 5 panels. Dans ces panels(Appelons les Panel1,2,..,5) j'affiche les infos.

    Dans le Panel1 par ex, j'ajoute autant de Panel (Appelons les PanelInfos1,2,...) que j'ai d'infos dans mon exel.

    Structure du Panel1 (exemple):
    label-textbox-label-textbox-label-textbox. --> PanelInfos1
    label-textbox-label-textbox-label-textbox. --> PanelInfos2
    label-textbox-label-textbox-label-textbox. --> PanelInfos3
    label-textbox-label-textbox-label-textbox. --> PanelInfos4

    Voila pour la présentation.

    Pour réaliser cela, j'ai une classe (visualisation) qui affiche tout cela:
    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
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    package Interface;
     
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Label;
    import java.awt.Toolkit;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.text.SimpleDateFormat;
    import java.util.ArrayList;
     
    import javax.swing.BorderFactory;
    import javax.swing.BoxLayout;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.border.EtchedBorder;
     
    import sources.ExtractionXLS;
    import sources.ExtractionXML;
    import sources.FormatageXML;
     
    import Interface.Groudreport.GroundReportPnl;
    import Interface.Groudreport.GroungReportInfos;
    import Interface.Lastlegreport.LastLegReportInfos;
    import Interface.Lastlegreport.LastLegReportPnl;
    import Interface.Previouslegreport.PreviousLegReportInfos;
    import Interface.Previouslegreport.PreviousLegReportPnl;
    import Interface.Totalflighttime.TotalFlightTimePnl;
    import Interface.Troubleshootdata.TroubleShootDataInfos;
    import Interface.Troubleshootdata.TroubleShootDataPnl;
     
    public class Visualisation extends JFrame implements ActionListener {
     
    	private JPanel MasterPnlVisu;
    	private int AppliWidth;
    	private int AppliHeight;
    		private JPanel PnlTitle;
    			private static Label PN;
    			private static Label SN;
    			private Label Titre;
    			private static Label DateDay;
    		private JPanel PnlInfos;
    			private JScrollPane ScrollInfos;	
    			private TotalFlightTimePnl TotalFlightTime;
    			private static LastLegReportPnl LasLegReport;
    			private static PreviousLegReportPnl PreviousLegReport;
    			private static GroundReportPnl GroundReport;
    			private static TroubleShootDataPnl TroubleShootData;
    		private JPanel PnlBtn;
    			private JButton BtnPrint;
     
    	private Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
     
     
    	public Visualisation(String Type)
    	{
    		this.setTitle("aa");
    		AppliWidth = screenSize.width/2+425;
    		AppliHeight = screenSize.height-65;
     
    		/*-------------------------------Le panel de fond--------------------------------------*/
    		MasterPnlVisu = new JPanel();
    			MasterPnlVisu.setPreferredSize(new Dimension(AppliWidth,AppliHeight));
    			MasterPnlVisu.setLayout(new GridBagLayout());
    			GridBagConstraints c = new GridBagConstraints();
     
    			/*-------------------------Le panel de titre---------------------------------------*/
    			PnlTitle = new JPanel();
    				//PnlTitle.setComponentZOrder(MasterPnlVisu, 1);
    				PnlTitle.setLayout(new GridBagLayout());
    				PnlTitle.setPreferredSize(new Dimension(AppliWidth-10,(AppliHeight)*10/100));
    				PnlTitle.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
    				c.fill = GridBagConstraints.HORIZONTAL;
    				c.gridx = 0;
    				c.gridy = 0;
    				MasterPnlVisu.add(PnlTitle,c);
     
    				if(Type.equals("XLS"))
    				{
    					PN = new Label("P/N: "+ExtractionXLS.GetPartNumber());
    				}
    				else
    				{
    					PN = new Label("P/N: "+ExtractionXML.GetPartNumber());
    				}
    				c.fill = c.fill = GridBagConstraints.HORIZONTAL;
    				c.gridx = 1;
    				c.gridy = 1;
    				PnlTitle.add(PN,c);
     
    				if(Type.equals("XLS"))
    				{
    					SN = new Label("S/N: "+ExtractionXLS.GetSerialNumber());
    				}
    				else
    				{
    					SN = new Label("S/N: "+ExtractionXML.GetSerialNumber());
    				}
    				c.fill = c.fill = GridBagConstraints.HORIZONTAL;
    				c.gridx = 0;
    				c.gridy = 1;
    				PnlTitle.add(SN,c);
     
    				Titre = new Label("AUTO SCAN REPORT");
    				c.fill = c.fill = GridBagConstraints.HORIZONTAL;
    				c.gridx = 1;
    				c.gridy = 0;
    				PnlTitle.add(Titre,c);
     
    				DateDay = new Label();
    				SimpleDateFormat dateStandard = new SimpleDateFormat("dd/MM/yyyy");
    				if(Type.equals("XLS"))
    				{
    					DateDay.setText(dateStandard.format(ExtractionXLS.GetDate()));
    				}
    				else
    				{
    					DateDay.setText(ExtractionXML.GetDate());
    				}
    				c.gridx = 2;
    				c.gridy = 1;
    				PnlTitle.add(DateDay,c);
    			/*----------------------------------------------------------------------------------*/
     
     
    			/*--------------------------Le panel pour les infos---------------------------------*/
    			PnlInfos = new JPanel();
    				ScrollInfos = new JScrollPane(PnlInfos);
    				//ScrollInfos.setComponentZOrder(MasterPnlVisu, 1);
    				ScrollInfos.setAutoscrolls(true);
    				ScrollInfos.setVisible(true);
    				ScrollInfos.setPreferredSize(new Dimension(AppliWidth-10,(AppliHeight-65)*89/100));
    				PnlInfos.setLayout(new BoxLayout(PnlInfos,BoxLayout.Y_AXIS));
    				c.fill = GridBagConstraints.HORIZONTAL;
    				c.gridx = 0;
    				c.gridy = 1;
    				MasterPnlVisu.add(ScrollInfos,c);
     
    				TotalFlightTime = new TotalFlightTimePnl();
     
    				PnlInfos.add(TotalFlightTime);
     
     
     
    				PnlInfos.add(LasLegReport);
     
     
     
    				PnlInfos.add(PreviousLegReport);
     
     
     
     
    				PnlInfos.add(GroundReport);
     
     
     
    				PnlInfos.add(TroubleShootData);
    			/*----------------------------------------------------------------------------------*/
     
    			/*----------------------Le panel pour les boutons print et quit---------------------*/
    			PnlBtn = new JPanel();
    				PnlBtn.setPreferredSize(new Dimension(AppliWidth-10,30));
    				PnlBtn.setLayout(new BorderLayout());
    				//PnlBtn.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
    				c.gridx = 0;
    				c.gridy = 2;
    				MasterPnlVisu.add(PnlBtn,c);
     
    				BtnPrint = new JButton("Imprimer");
    				BtnPrint.addActionListener(this);
    				BtnPrint.setActionCommand("Print");
    				PnlBtn.add(BtnPrint,BorderLayout.CENTER);
     
     
     
    			/*----------------------------------------------------------------------------------*/
    		/*----------------------------------------------------------------------------------*/
     
    		getContentPane().add(MasterPnlVisu);
    		pack();
    		setVisible(true);
     
     
    	}
     
     
    	public static void CreatePreviousLegReport(ArrayList<PreviousLegReportInfos> sesInfos)
    	{
    		PreviousLegReport = new PreviousLegReportPnl(sesInfos);
    	}
     
    	public static void CreateLastLegReport(ArrayList<LastLegReportInfos> sesInfos)
    	{
    		LasLegReport = new LastLegReportPnl(sesInfos);
    	}
     
    	public static void CreateTroubleShootData(ArrayList<TroubleShootDataInfos> sesInfos)
    	{
    		TroubleShootData = new TroubleShootDataPnl(sesInfos);
    	}
     
    	public static void CreateGroungReport(ArrayList<GroungReportInfos> sesInfos)
    	{
    		GroundReport = new GroundReportPnl(sesInfos);
    	}
     
    	public static void SetPn(String text)
    	{
    		PN.setText(text);
    	}
     
    	public static void SetSN(String text)
    	{
    		SN.setText(text);
    	}
     
    	public static void SetDateDay(String text)
    	{
    		DateDay.setText(text);
    	}
     
    	public void actionPerformed(ActionEvent e) 
    	{	
    		if(e.getActionCommand().equals("Print"))
    		{
    			FormatageXML testxml = new FormatageXML();
    		}
     
     
    	}
     
    }
    J ai une autre classe qui va lire dans mon XLS et qui remplit les différentes arraylist pour construire les PanelInfos de mon exemple du dessus. Chaque "PanelInfos" est composé de deux classe:
    La première gère l'affichage du panel en entier (dans l'exemple c'est Panel1):
    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
    package Interface.Troubleshootdata;
     
    import java.awt.Label;
    import java.util.ArrayList;
     
    import javax.swing.BorderFactory;
    import javax.swing.BoxLayout;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    import javax.swing.border.TitledBorder;
     
    import Interface.Previouslegreport.PreviousLegReportInfos;
     
    public class TroubleShootDataPnl extends JPanel {
     
     
    	public TroubleShootDataPnl(ArrayList<TroubleShootDataInfos> sesInfos)
    	{
    		setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
    		setBorder(BorderFactory.createTitledBorder(null, "Trouble Shoot Data",TitledBorder.CENTER, 0));
    		for(TroubleShootDataInfos test : sesInfos)
    		{
    			add(test);
    		}
     
    	}
     
    }
    et la deuxième pour les labels et les textbox
    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
    package Interface.Troubleshootdata;
     
    import java.awt.Label;
     
    import javax.swing.JPanel;
    import javax.swing.JTextField;
     
    import sources.ExtractionXLS;
     
    public class TroubleShootDataInfos extends JPanel {
     
    	private Label LblDateTrbl;
    	private Label LblHeureTrbl;
    	private Label LblTypeTrbl;
    	private JTextField TxtDateTrbl;
    	private JTextField TxtHeureTrbl;
    	private JTextField TxtTypeTrbl;
     
    	public TroubleShootDataInfos()
    	{
    		LblDateTrbl = new Label("Date :");
    		LblHeureTrbl = new Label("Heure :");
    		LblTypeTrbl = new Label("Type :");
    		TxtDateTrbl = new JTextField(7);
    		TxtHeureTrbl = new JTextField(4);
    		TxtTypeTrbl = new JTextField(30);
    		add(LblDateTrbl);
    		add(TxtDateTrbl);
    		add(LblHeureTrbl);
    		add(TxtHeureTrbl);
    		add(LblTypeTrbl);
    		add(TxtTypeTrbl);
     
    	}
     
    	public void SetDate(String Date)
    	{
    		TxtDateTrbl.setText(Date);
    	}
    	public void SetHeure(String Heure)
    	{
    		TxtHeureTrbl.setText(Heure);
    	}
    	public void SetType(String Type)
    	{
    		TxtTypeTrbl.setText(Type);
    	}
    	public String GetDate()
    	{
    		return TxtDateTrbl.getText();
    	}
    	public String GetHeure()
    	{
    		return TxtHeureTrbl.getText();
    	}
    	public String GetType()
    	{
    		return TxtTypeTrbl.getText();
    	}
     
    }
    J'espère que je suis assez clair

  7. #7
    Membre actif
    Avatar de Grumphette
    Homme Profil pro
    Validation manager
    Inscrit en
    Juillet 2008
    Messages
    81
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Validation manager

    Informations forums :
    Inscription : Juillet 2008
    Messages : 81
    Par défaut
    Donc au moment ou l'afichage ce fait, tout est correct sauf les labels qui sont normalement caché par les panels sont "toujours premier plan".

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

Discussions similaires

  1. Probleme avec un "order by"
    Par LineLe dans le forum ASP
    Réponses: 30
    Dernier message: 16/09/2003, 16h38
  2. ORDER BY
    Par mythtvtalk.com dans le forum MS SQL Server
    Réponses: 5
    Dernier message: 11/07/2003, 12h56
  3. [Crystal report] Component
    Par Antichoc dans le forum SAP Crystal Reports
    Réponses: 4
    Dernier message: 24/04/2003, 17h11
  4. ORDER BY dans un ordre inhabituel
    Par Riam dans le forum SQL Procédural
    Réponses: 2
    Dernier message: 21/03/2003, 14h29
  5. Component not found
    Par Pm dans le forum XMLRAD
    Réponses: 2
    Dernier message: 28/01/2003, 15h40

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