2020-11-21 19:47:38 +01:00
|
|
|
import javax.swing.*;
|
|
|
|
|
import javax.swing.border.BevelBorder;
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
|
2020-11-22 15:55:26 +01:00
|
|
|
/**
|
|
|
|
|
* Affiche une barre de statut au pied de la fenêtre
|
|
|
|
|
* @author V.BOULANGER
|
|
|
|
|
*/
|
2020-11-21 19:47:38 +01:00
|
|
|
public class AppThinkerStatusbar extends JPanel {
|
2020-11-22 23:34:44 +01:00
|
|
|
|
|
|
|
|
private JLabel _statusLabel;
|
|
|
|
|
private JLabel _posXLabel;
|
|
|
|
|
private JLabel _posYLabel;
|
|
|
|
|
private JLabel _sizeXLabel;
|
|
|
|
|
private JLabel _sizeYLabel;
|
|
|
|
|
private JLabel _fileLabel;
|
|
|
|
|
|
2020-11-21 19:47:38 +01:00
|
|
|
/**
|
|
|
|
|
* Constructeur de la classe AppThinkerStatusbar
|
|
|
|
|
*/
|
|
|
|
|
public AppThinkerStatusbar(){
|
|
|
|
|
//Création de la statusBar
|
|
|
|
|
this.setBorder(new BevelBorder(BevelBorder.LOWERED));
|
|
|
|
|
this.setLayout(new GridLayout(1,3));
|
|
|
|
|
|
2020-12-07 22:18:54 +01:00
|
|
|
_statusLabel = new JLabel("Create or import a project to start.");
|
2020-11-22 23:34:44 +01:00
|
|
|
this.add(_statusLabel);
|
2020-11-21 19:47:38 +01:00
|
|
|
|
|
|
|
|
JPanel actionBar = new JPanel();
|
|
|
|
|
|
2020-11-22 23:34:44 +01:00
|
|
|
_posXLabel = new JLabel("PX : 0 |");
|
|
|
|
|
actionBar.add(_posXLabel);
|
|
|
|
|
_posYLabel = new JLabel("PY : 0 |");
|
|
|
|
|
actionBar.add(_posYLabel);
|
|
|
|
|
_sizeXLabel = new JLabel("SX : 0 |");
|
|
|
|
|
actionBar.add(_sizeXLabel);
|
|
|
|
|
_sizeYLabel = new JLabel("SY : 0");
|
|
|
|
|
actionBar.add(_sizeYLabel);
|
2020-11-21 19:47:38 +01:00
|
|
|
|
|
|
|
|
this.add(actionBar);
|
|
|
|
|
|
2020-12-09 12:48:52 +01:00
|
|
|
_fileLabel = new JLabel("No project opened.");
|
2020-11-22 23:34:44 +01:00
|
|
|
_fileLabel.setHorizontalAlignment(JLabel.RIGHT);
|
|
|
|
|
this.add(_fileLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Met à jour le texte de statut de la barre de statut.
|
2020-11-29 18:56:04 +01:00
|
|
|
* @param statusMessage Le message à afficher.
|
2020-11-22 23:34:44 +01:00
|
|
|
*/
|
2020-11-29 18:56:04 +01:00
|
|
|
public void setStatusMessage(String statusMessage){
|
|
|
|
|
this._statusLabel.setText(statusMessage);
|
2020-11-22 23:34:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Met à jour le nom du fichier dans la barre de statut.
|
2020-11-29 18:56:04 +01:00
|
|
|
* @param fileMessage Le nom du fichier à afficher.
|
2020-11-22 23:34:44 +01:00
|
|
|
*/
|
2020-11-29 18:56:04 +01:00
|
|
|
public void setFileMessage(String fileMessage){
|
|
|
|
|
this._fileLabel.setText(fileMessage);
|
2020-11-21 19:47:38 +01:00
|
|
|
}
|
2020-11-22 23:34:44 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Met à jour les labels de position.
|
|
|
|
|
* @param posX La position X.
|
|
|
|
|
* @param posY La position Y.
|
|
|
|
|
*/
|
|
|
|
|
public void setPosLabel(int posX, int posY){
|
2020-11-29 18:56:04 +01:00
|
|
|
this._posXLabel.setText("X : " + Integer.toString(posX) + " |");
|
|
|
|
|
this._posYLabel.setText("Y : " + Integer.toString(posY) + " |");
|
2020-11-22 23:34:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Met à jour les labels de taille.
|
|
|
|
|
* @param sizeX La taille X.
|
|
|
|
|
* @param sizeY La taille Y.
|
|
|
|
|
*/
|
|
|
|
|
public void setSizeLabel(int sizeX, int sizeY){
|
2020-11-29 18:56:04 +01:00
|
|
|
this._sizeXLabel.setText("SX : " + Integer.toString(sizeX));
|
|
|
|
|
this._sizeYLabel.setText("SY : " + Integer.toString(sizeY));
|
2020-11-22 23:34:44 +01:00
|
|
|
}
|
2020-11-21 19:47:38 +01:00
|
|
|
}
|