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
| package app;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class OngletThreads extends JPanel{
//Déclaration des elements du panel
static JLabel label1 = new JLabel();
static JLabel label2 = new JLabel();
static JLabel label3 = new JLabel();
static JLabel label4 = new JLabel();
static JLabel label5 =new JLabel();
static JLabel label6 =new JLabel();
static JLabel label7 = new JLabel();
//Constructeur
public OngletThreads(){
super();
AfficherThreads m = new AfficherThreads();
//Nom de l'onglet
JLabel titreOnglet = new JLabel("Threads");
//Titre dans l'onglet
//add(titreOnglet);
//Taille de l'onglet
setPreferredSize(new Dimension(600, 300));
//Définition du layout
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
//Placement du label1
//gridx:colonne de départ gridy: ligne de départ
gbc.gridx = gbc.gridy = 0;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.anchor = GridBagConstraints.CENTER;
gbc.insets = new Insets(5, 5, 5, 5);
add(label1, gbc);
//Placement du label2
gbc.gridx = 0;
gbc.gridy = 1;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.anchor = GridBagConstraints.CENTER;
gbc.insets = new Insets(5, 5, 5, 5);
add(label2, gbc);
//Label3
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridheight = gbc.gridwidth = 1;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.anchor = GridBagConstraints.CENTER;
gbc.insets = new Insets(5, 5, 5, 5);
add(label3, gbc);
//Label4
gbc.gridx = 0;
gbc.gridy = 3;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.anchor = GridBagConstraints.CENTER;
gbc.insets = new Insets(5, 5, 5, 5);
add(label4, gbc);
//Label5
gbc.gridx = 0;
gbc.gridy = 4;
gbc.gridheight = gbc.gridwidth = 1;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.anchor = GridBagConstraints.CENTER;
gbc.insets = new Insets(5, 5, 5, 5);
add(label5, gbc);
//Label6
gbc.gridx = 0;
gbc.gridy = 5;
gbc.gridheight = gbc.gridwidth = 1;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.anchor = GridBagConstraints.CENTER;
gbc.insets = new Insets(5, 5, 5, 5);
add(label6, gbc);
//Label7
gbc.gridx = 0;
gbc.gridy = 6;
gbc.gridheight = gbc.gridwidth = 1;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.anchor = GridBagConstraints.CENTER;
gbc.insets = new Insets(5, 5, 5, 5);
add(label7, gbc);
}
//Getter & Setter
public JLabel getLabel(){
return label1;
}
public JLabel getLabel2() {
return label2;
}
public JLabel getLabel3() {
return label3;
}
public JLabel getLabel4() {
return label4;
}
public JLabel getLabel5() {
return label5;
}
public JLabel getLabel6() {
return label6;
}
} |
Partager