List of usage examples for javax.swing.border EmptyBorder EmptyBorder
@ConstructorProperties({ "borderInsets" }) public EmptyBorder(Insets borderInsets)
From source file:vues.reseau.Panel_RejoindrePartieMulti.java
/** * Constructeur/*from w w w .j a v a 2 s .co m*/ * * @param parent le fenetre parent */ public Panel_RejoindrePartieMulti(JFrame parent) { // initialisation super(new BorderLayout()); this.parent = parent; parent.setTitle(Langue.getTexte(Langue.ID_TITRE_REJOINDRE_UNE_PARTIE_MULTI)); setBorder(new EmptyBorder(new Insets(MARGES_PANEL, MARGES_PANEL, MARGES_PANEL, MARGES_PANEL))); setBackground(LookInterface.COULEUR_DE_FOND_PRI); // --------- // -- TOP -- // --------- JPanel pTop = new JPanel(new BorderLayout()); pTop.setBackground(LookInterface.COULEUR_DE_FOND_PRI); JLabel titre = new JLabel(Langue.getTexte(Langue.ID_TITRE_REJOINDRE_UNE_PARTIE_MULTI)); titre.setFont(GestionnaireDesPolices.POLICE_TITRE); titre.setForeground(LookInterface.COULEUR_TEXTE_PRI); pTop.add(titre, BorderLayout.NORTH); // filtre JPanel pADroite = new JPanel(new BorderLayout()); pADroite.setBackground(LookInterface.COULEUR_DE_FOND_PRI); tfFiltre.setPreferredSize(new Dimension(100, 25)); tfFiltre.addKeyListener(this); tfFiltre.addMouseListener(this); pADroite.add(tfFiltre, BorderLayout.WEST); pTop.add(pADroite, BorderLayout.CENTER); GestionnaireDesPolices.setStyle(bRafraichir); pTop.add(bRafraichir, BorderLayout.EAST); bRafraichir.addActionListener(this); add(pTop, BorderLayout.NORTH); // ------------ // -- CENTER -- // ------------ // cration de la table avec boquage des editions tbServeurs = new JTable(model) { public boolean isCellEditable(int rowIndex, int colIndex) { return false; // toujours dsactiv } }; // Simple selection tbServeurs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // nom de colonnes model.addColumn(Langue.getTexte(Langue.ID_TXT_NOM)); model.addColumn(Langue.getTexte(Langue.ID_TXT_IP)); model.addColumn(Langue.getTexte(Langue.ID_TXT_PORT)); model.addColumn(Langue.getTexte(Langue.ID_TXT_MODE)); model.addColumn(Langue.getTexte(Langue.ID_TXT_TERRAIN)); model.addColumn(Langue.getTexte(Langue.ID_TXT_PLACES_DISPO)); // Cration du canal avec le serveur d'enregistrement try { canalServeurEnregistrement = new CanalTCP(Configuration.getIpSE(), Configuration.getPortSE()); mettreAJourListeDesServeurs(); } catch (ConnectException e) { connexionSEImpossible(); } catch (CanalException e) { connexionSEImpossible(); } // ajout dans le panel add(new JScrollPane(tbServeurs), BorderLayout.CENTER); // ------------ // -- BOTTOM -- // ------------ JPanel pBottom = new JPanel(new BorderLayout()); pBottom.setBackground(LookInterface.COULEUR_DE_FOND_PRI); bRetour.addActionListener(this); GestionnaireDesPolices.setStyle(bRetour); bRetour.setPreferredSize(new Dimension(80, 50)); pBottom.add(bRetour, BorderLayout.WEST); JPanel bottomCenter = new JPanel(); bottomCenter.setBackground(LookInterface.COULEUR_DE_FOND_PRI); // connexion par IP lblConnexionParIP.setFont(GestionnaireDesPolices.POLICE_SOUS_TITRE); lblConnexionParIP.setForeground(LookInterface.COULEUR_TEXTE_PRI); bottomCenter.add(lblConnexionParIP); tfConnexionParIP.setPreferredSize(new Dimension(100, 25)); bottomCenter.add(tfConnexionParIP); tfConnexionParIP.addMouseListener(this); // pseudo JPanel pPseudo = new JPanel(); JPanel pTmp = new JPanel(); lblPseudo.setFont(GestionnaireDesPolices.POLICE_SOUS_TITRE); lblPseudo.setForeground(LookInterface.COULEUR_TEXTE_PRI); bottomCenter.add(lblPseudo); tfPseudo.setText(Configuration.getPseudoJoueur()); bottomCenter.add(tfPseudo); pPseudo.add(pTmp, BorderLayout.EAST); pBottom.add(bottomCenter, BorderLayout.CENTER); // bouton rejoindre bRejoindre.setPreferredSize(new Dimension(100, 50)); GestionnaireDesPolices.setStyle(bRejoindre); pBottom.add(bRejoindre, BorderLayout.EAST); bRejoindre.addActionListener(this); pBottom.add(lblEtat, BorderLayout.SOUTH); add(pBottom, BorderLayout.SOUTH); }