Citation :
import java.awt.*;
import java.util.*;
import javax.swing.*;
public class Sujet extends JPanel{
String theme;
Collection<Message> messages;
String createur;
Dateformate datesujet ;
Dateformate date_last_message;
int numMessage=0;
int numSujet;
JLabel pseudo;
JLabel categorie;
JLabel nbmessage;
JLabel last_message;
JLabel modo;
JLabel voir;
Sujet(int numero,String temp,String user){
theme=temp;
messages=new HashSet<Message>();
createur=user;
datesujet = new Dateformate();
numSujet=numero;
}
void creationGraphique(){
this.setPreferredSize(new Dimension(700,50));
this.setLayout(null);
String useretdate=new String();
useretdate="<html>"+createur+"<br>"+datesujet.dateEtHeure()+"</html>";
pseudo=new JLabel(useretdate,JLabel.CENTER);
pseudo.setBounds(0,0,100,50);
pseudo.setBorder(new javax.swing.border.EtchedBorder());
this.add(pseudo);
categorie=new JLabel(theme,JLabel.CENTER);
categorie.setBounds(101,0,350,50);
categorie.setBorder(new javax.swing.border.EtchedBorder());
this.add(categorie);
nbmessage=new JLabel(""+numMessage,JLabel.CENTER);
nbmessage.setBounds(451,0,100,50);
nbmessage.setBorder(new javax.swing.border.EtchedBorder());
this.add(nbmessage);
String chaine=new String();
if(numMessage!=0){
chaine=date_last_message.dateEtHeure();
}
else{chaine="";
}
last_message=new JLabel(chaine,JLabel.CENTER);
last_message.setBounds(551,0,100,50);
last_message.setBorder(new javax.swing.border.EtchedBorder());
this.add(last_message);
modo=new JLabel("Modérateur",JLabel.CENTER);
modo.setBounds(651,0,100,50);
modo.setBorder(new javax.swing.border.EtchedBorder());
this.add(modo);
voir=new JLabel("Voir",JLabel.CENTER);
voir.setBounds(751,0,56,50);
voir.setBorder(new javax.swing.border.EtchedBorder());
this.add(voir);
}
}
|