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
|
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.lang.String;
class PanelStat extends JPanel
{
private JLabel labelAge;
private JProgressBar barSante;
private JProgressBar barExperience;
private JProgressBar barFaim;
private JProgressBar barPoids;
private JProgressBar barSommeil;
private JProgressBar barEnnui;
private JProgressBar barSalissure;
PanelStat()
{
setLayout(new GridLayout(15,1));
JLabel labelAge = new JLabel("Age: 0");
add(labelAge);
JLabel labelSante = new JLabel("Santé :");
add(labelSante);
barSante = new JProgressBar(JProgressBar.HORIZONTAL,0,1000);
add(barSante);
JLabel labelExperience = new JLabel("Experience :");
add(labelExperience);
barExperience = new JProgressBar(JProgressBar.HORIZONTAL,0,1000);
add(barExperience);
JLabel labelFaim = new JLabel("Faim :");
add(labelFaim);
barFaim = new JProgressBar(JProgressBar.HORIZONTAL,0,1000);
add(barFaim);
JLabel labelPoids = new JLabel("Poids :");
add(labelPoids);
barPoids = new JProgressBar(JProgressBar.HORIZONTAL,0,1000);
add(barPoids);
JLabel labelSommeil = new JLabel("Sommeil :");
add(labelSommeil);
barSommeil = new JProgressBar(JProgressBar.HORIZONTAL,0,1000);
add(barSommeil);
JLabel labelEnnui = new JLabel("Ennui :");
add(labelEnnui);
barEnnui = new JProgressBar(JProgressBar.HORIZONTAL,0,1000);
add(barEnnui);
JLabel labelSalissure = new JLabel("Salissure :");
add(labelSalissure);
barSalissure = new JProgressBar(JProgressBar.HORIZONTAL,0,1000);
add(barSalissure);
}
public void setLabelAge(int val)
{
labelAge.setText("Age : "+val);
}
public void setBarSante(int val)
{
barSante.setValue(val);
}
public void setBarExperience(int val)
{
barExperience.setValue(val);
}
public void setBarFaim(int val)
{
barFaim.setValue(val);
}
public void setBarPoids(int val)
{
barPoids.setValue(val);
}
public void setBarSommeil(int val)
{
barSommeil.setValue(val);
}
public void setBarEnnui(int val)
{
barEnnui.setValue(val);
}
public void setBarSalissure(int val)
{
barSalissure.setValue(val);
}
public void miseAjourBarre(Individu tama)
{
setBarSommeil(tama.getSommeil());
setBarFaim(tama.getFaim());
setBarEnnui(tama.getEnnui());
setBarPoids(tama.getPoids());
setBarSante(tama.getSante());
setBarSalissure(tama.getSalete());
setLabelAge(tama.getAge());
}
} |
Partager