This commit is contained in:
2025-10-23 02:21:32 +02:00
9 changed files with 469 additions and 206 deletions
@@ -0,0 +1,37 @@
import javax.swing.*;
import javax.swing.Icon;
import java.awt.*;
/**
* Renderer simple pour afficher un petit carré coloré dans la liste déroulante.
* J'utilise juste un switch pour déterminer la couleur à partir du nom.
*/
public class CouleurList extends DefaultListCellRenderer {
/** renvoie la couleur correspondant au nom affiché dans le menu */
public static Color couleurDe(String nom) {
switch (nom) {
case "Bleu": return Color.CYAN; // ou Color.BLUE si tu veux un bleu plus foncé
case "Rouge": return Color.RED;
case "Vert": return Color.GREEN;
case "Jaune": return Color.YELLOW;
case "Gris": return Color.LIGHT_GRAY;
default: return Color.WHITE;
}
}
@Override
public Component getListCellRendererComponent(JList list, Object value, int index,boolean isSelected, boolean cellHasFocus) {
JLabel lbl = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value != null) {
String nom = value.toString();
lbl.setIcon(new ColorIcon(couleurDe(nom), 14, 14));
lbl.setIconTextGap(8); // petit espace entre le carré et le texte
}
return lbl;
}
}
+14 -19
View File
@@ -6,29 +6,24 @@ import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
public class Crud extends ArrayList<JButton> implements ActionListener{ public class Crud extends ArrayList<JButton>{
private JButton btnAdd = new JButton("Ajouter"); private Main main;
private JButton btnDel = new JButton("Supprimer");
private final Main main; private BtnAjouter btnAjt;
private BtnSupprimer btnSpr;
private BtnModifier btnMdf;
public Crud(Main main){ public Crud(Main main){
this.main = main; this.main = main;
btnAdd.setPreferredSize(new Dimension(120, 25)); btnAjt = new BtnAjouter(main);
btnDel.setPreferredSize(new Dimension(120, 25)); btnSpr = new BtnSupprimer(main);
btnAdd.addActionListener(this); btnMdf = new BtnModifier(main);
btnDel.addActionListener(this); add(btnAjt);
add(btnAdd); add(btnSpr);
add(btnDel); add(btnMdf);
} }
public void actionPerformed(ActionEvent e){
if(e.getSource()==btnAdd){
System.out.println("test ajouter");
main.ouvrirFenetreAjout();
}
if(e.getSource()==btnDel){
System.out.println("test supprimer");
}
}
} }
+54 -43
View File
@@ -8,8 +8,14 @@ public class FenetreAjout extends JFrame implements ActionListener {
private final JTextField champTitre; private final JTextField champTitre;
private final JTextArea champContenu; private final JTextArea champContenu;
private final JTextField rang; private Integer[] nombres = {1, 2, 3, 4, 5};
private final JTextField theme; private JComboBox<Integer> rang = new JComboBox<>(nombres);
private final String[] nomsCouleurs = {"Bleu", "Rouge", "Vert", "Jaune", "Gris"};
private final JComboBox<String> comboTheme = new JComboBox<>(nomsCouleurs);
private final JButton boutonValider; private final JButton boutonValider;
private final JButton boutonAnnuler; private final JButton boutonAnnuler;
private final Main parent; private final Main parent;
@@ -20,7 +26,6 @@ public class FenetreAjout extends JFrame implements ActionListener {
setSize(350, 250); setSize(350, 250);
setResizable(false); setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Layout principal // Layout principal
@@ -34,64 +39,51 @@ public class FenetreAjout extends JFrame implements ActionListener {
// Titre // Titre
JLabel lblTitre = new JLabel("Titre :"); JLabel lblTitre = new JLabel("Titre :");
champTitre = new JTextField(20); champTitre = new JTextField(20);
c.gridx = 0; c.gridx = 0; c.gridy = 1; c.weightx = 0;
c.gridy = 1;
c.weightx = 0;
centre.add(lblTitre, c); centre.add(lblTitre, c);
c.gridx = 1; c.gridx = 1; c.gridy = 1; c.weightx = 1;
c.gridy = 1;
c.weightx = 1;
centre.add(champTitre, c); centre.add(champTitre, c);
// Contenu // Contenu
JLabel lblContenu = new JLabel("Contenu :"); JLabel lblContenu = new JLabel("Contenu :");
champContenu = new JTextArea(4, 20); champContenu = new JTextArea(4, 20);
champContenu.setLineWrap(true); // active le retour à la ligne
champContenu.setWrapStyleWord(true); // évite de couper un mot en plein milieu
JScrollPane scroll = new JScrollPane(champContenu, JScrollPane scroll = new JScrollPane(champContenu,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
c.gridx = 0; c.gridx = 0; c.gridy = 2; c.weightx = 0;
c.gridy = 2;
c.weightx = 0;
c.fill = GridBagConstraints.BOTH; c.fill = GridBagConstraints.BOTH;
centre.add(lblContenu, c); centre.add(lblContenu, c);
c.gridx = 1; c.gridx = 1; c.gridy = 2; c.weightx = 1; c.weighty = 1.0;
c.gridy = 2;
c.weightx = 1;
c.weighty = 1.0; // prend la hauteur dispo
centre.add(scroll, c); centre.add(scroll, c);
// Rang // Rang
JLabel lblrang = new JLabel("Rang :"); JLabel lblrang = new JLabel("Rang :");
rang = new JTextField(20); c.gridx = 0; c.gridy = 3; c.weightx = 0; c.weighty = 0.0;
c.gridx = 0;
c.gridy = 3;
c.weightx = 0;
c.weighty = 0.0; // prend la hauteur dispo
centre.add(lblrang, c); centre.add(lblrang, c);
c.gridx = 1; c.gridx = 1; c.gridy = 3; c.weightx = 1;
c.gridy = 3;
c.weightx = 1;
centre.add(rang, c); centre.add(rang, c);
// theme
JLabel lbltheme = new JLabel("Theme :");
theme = new JTextField(20); // Theme
c.gridx = 0; c.gridx = 0; c.gridy = 4; c.weightx = 0;
c.gridy = 4; centre.add(new JLabel("Theme :"), c);
c.weightx = 0;
centre.add(lbltheme, c); // liste déroulante de couleurs
c.gridx = 1; c.gridx = 1; c.gridy = 4; c.weightx = 1;
c.gridy = 4; comboTheme.setRenderer(new CouleurList());
c.weightx = 1; comboTheme.setSelectedItem("Bleu"); // valeur par défaut
centre.add(theme, c); centre.add(comboTheme, c);
// Bas : boutons // Bas : boutons
JPanel bas = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10)); JPanel bas = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10));
boutonValider = new JButton("Valider"); boutonValider = new JButton("Valider");
boutonAnnuler = new JButton("Annuler"); boutonAnnuler = new JButton("Annuler");
// on enregistre les actions ici
boutonValider.addActionListener(this); boutonValider.addActionListener(this);
boutonAnnuler.addActionListener(this); boutonAnnuler.addActionListener(this);
@@ -100,6 +92,12 @@ public class FenetreAjout extends JFrame implements ActionListener {
add(bas, BorderLayout.SOUTH); add(bas, BorderLayout.SOUTH);
} }
public Color getCouleurChoix() {
String nom = (String) comboTheme.getSelectedItem();
return CouleurList.couleurDe(nom);
}
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
Object src = e.getSource(); Object src = e.getSource();
@@ -107,25 +105,38 @@ public class FenetreAjout extends JFrame implements ActionListener {
if (src == boutonAnnuler) { if (src == boutonAnnuler) {
// revenir à la fenêtre principale // revenir à la fenêtre principale
Point pos = this.getLocation(); Point pos = this.getLocation();
parent.setLocation(pos); parent.setLocation(pos);
parent.setVisible(true); parent.setVisible(true);
this.setVisible(false); this.dispose();
return; return;
} }
if (src == boutonValider) { if (src == boutonValider) {
String titre = champTitre.getText().trim(); String titre = champTitre.getText().trim();
String contenu = champContenu.getText().trim(); String contenu = champContenu.getText().trim();
int Nrang = (Integer) rang.getSelectedItem();
String cTheme = (String)comboTheme.getSelectedItem();
GestionRappel g = new GestionRappel();
if (titre.isEmpty() || contenu.isEmpty()) { if (titre.isEmpty() || contenu.isEmpty()) {
JOptionPane.showMessageDialog(this, "Veuillez remplir les deux champs."); JOptionPane.showMessageDialog(this, "Veuillez remplir tout les champs.", "Champs manquants", JOptionPane.WARNING_MESSAGE);
return; return;
}else{
try{
g.ajouter(new Rappel(titre,contenu,cTheme,Nrang));
} catch (Exception ex) {
ex.printStackTrace(); // affiche l'erreur dans le terminal
} }
// TODO: ici appeler une méthode du parent pour ajouter le rappel }
// parent.ajouterRappel(titre, contenu);
Main reParent = new Main();
parent.setVisible(true); reParent.setLocation(this.getLocation());
reParent.setVisible(true);
dispose(); dispose();
} }
} }
+140
View File
@@ -0,0 +1,140 @@
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class FenetreModif extends JFrame implements ActionListener {
private final Main parent; // fenêtre principal (peut être null si tu veux)
private final Rappel rappel; // rappel à modifier (peut être null si tu veux)
private GestionRappel ges = new GestionRappel();
private final JTextField champTitre;
private final JTextArea champContenu;
private Integer[] nombres = {1, 2, 3, 4, 5};
private JComboBox<Integer> rang = new JComboBox<>(nombres);
private final JTextField theme;
private final JButton boutonValider;
private final JButton boutonAnnuler;
/**
* @param parent la fenêtre principale (utilisée pour revenir au même endroit)
* @param rappel le rappel à modifier (peut être null si tu veux juste récupérer des valeurs)
* @param titre titre initial à afficher (utilisé si rappel==null ou si tu préfères passer la valeur)
* @param contenu contenu initial à afficher (idem)
*/
public FenetreModif(Main parent, Rappel rappel, String titre, String contenu) {
super("Modifier un rappel");
this.parent = parent;
this.rappel = rappel;
setSize(350, 250);
setResizable(false);
setLocation(parent.getLocation()); // même position que Main
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// ------ UI ------
setLayout(new BorderLayout(10, 10));
JPanel centre = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.insets = new Insets(4, 4, 4, 4);
c.fill = GridBagConstraints.HORIZONTAL;
// Titre
JLabel lblTitre = new JLabel("Titre :");
champTitre = new JTextField(20);
c.gridx = 0; c.gridy = 0; c.weightx = 0;
centre.add(lblTitre, c);
c.gridx = 1; c.gridy = 0; c.weightx = 1;
centre.add(champTitre, c);
// Contenu
JLabel lblContenu = new JLabel("Contenu :");
champContenu = new JTextArea(4, 20);
champContenu.setLineWrap(true); // active le retour à la ligne
champContenu.setWrapStyleWord(true); // évite de couper un mot en plein milieu
JScrollPane scroll = new JScrollPane(champContenu);
c.gridx = 0; c.gridy = 1; c.weightx = 0;
centre.add(lblContenu, c);
c.fill = GridBagConstraints.BOTH;
c.gridx = 1; c.gridy = 1; c.weightx = 1; c.weighty = 1.0;
centre.add(scroll, c);
// rang
c.fill = GridBagConstraints.HORIZONTAL;
rang.setSelectedIndex(rappel.getRang()-1);
JLabel lblRang = new JLabel("Rang :");
c.gridx = 0; c.gridy = 2; c.weightx = 0;
centre.add(lblRang, c);
c.gridx = 1; c.gridy = 2; c.weightx = 1;
centre.add(rang, c);
// theme
JLabel lblTheme = new JLabel("Theme");
theme = new JTextField(20);
c.gridx = 0; c.gridy = 3; c.weightx = 0;
centre.add(lblTheme, c);
c.gridx = 1; c.gridy = 3; c.weightx = 1;
centre.add(theme, c);
add(centre, BorderLayout.CENTER);
// Bas : boutons
JPanel bas = new JPanel(new FlowLayout(FlowLayout.RIGHT));
boutonValider = new JButton("Valider");
boutonAnnuler = new JButton("Annuler");
boutonValider.addActionListener(this);
boutonAnnuler.addActionListener(this);
bas.add(boutonValider);
bas.add(boutonAnnuler);
add(bas, BorderLayout.SOUTH);
champTitre.setText(rappel.getTitre());
champContenu.setText(rappel.getContenu());
}
@Override
public void actionPerformed(ActionEvent e) {
Object src = e.getSource();
if (src == boutonAnnuler) {
parent.setLocation(this.getLocation());
parent.setVisible(true);
this.dispose();
return;
}
if (src == boutonValider) {
String t = champTitre.getText().trim();
String c = champContenu.getText().trim();
int r = (Integer) rang.getSelectedItem();
if (t.isEmpty() || c.isEmpty()) {
JOptionPane.showMessageDialog(this, "Veuillez remplir les deux champs.", "Champs manquants", JOptionPane.WARNING_MESSAGE);
return;
}
// MAJ directe du rappel
rappel.setTitre(t);
rappel.setContenu(c);
rappel.setRang(r);
try{
ges.modifierParId(rappel.getId(), rappel);
} catch (Exception ex) {
ex.printStackTrace();
}
Main reParent = new Main();
reParent.setLocation(this.getLocation());
reParent.setVisible(true);
dispose();
}
}
}
+33 -30
View File
@@ -2,8 +2,12 @@
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
public class Main extends JFrame { public class Main extends JFrame {
private final List<PanelRappel> listRpl = new ArrayList<>();
public Main(){ public Main(){
super("Papillon"); super("Papillon");
@@ -25,25 +29,31 @@ public class Main extends JFrame {
// Colonne 0 : boutons // Colonne 0 : boutons
c.fill = GridBagConstraints.HORIZONTAL; c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.NORTHWEST; c.anchor = GridBagConstraints.NORTHWEST;
c.insets = new Insets(5, 5, 5, 5); c.insets = new Insets(4, 4, 4, 4);
for(int i = 0; i< crud.size() ;i++){
c.gridx = 0; c.gridx = 0;
c.gridy = 0; c.gridy = i;
body.add(crud.get(0), c); c.weighty = 0;
body.add(crud.get(i), c);
c.gridx = 0; }
c.gridy = 1;
body.add(crud.get(1), c);
// Colonne 1 : liste verticale de Rappel dans un JScrollPane // Colonne 1 : liste verticale de Rappel dans un JScrollPane
JPanel liste = new JPanel(); JPanel liste = new JPanel();
liste.setLayout(new BoxLayout(liste, BoxLayout.Y_AXIS)); liste.setLayout(new BoxLayout(liste, BoxLayout.Y_AXIS));
//rappels //Rappels
GestionRappel g = new GestionRappel();
List<Rappel> listBd = new ArrayList<>();
try {
listBd = g.lister();
} catch (Exception e) {
e.printStackTrace(); // affiche l'erreur dans le terminal
}
for (int i = 0; i < 5; i++) { for (int i = 0; i < listBd.size() ; i++) {
Rappel r = new Rappel(); PanelRappel r = new PanelRappel(listBd.get(i));
liste.add(r); liste.add(r);
listRpl.add(r);
} }
JScrollPane scroll = new JScrollPane( JScrollPane scroll = new JScrollPane(
@@ -56,17 +66,25 @@ public class Main extends JFrame {
// place le scrollpane a droite, sur la hauteur des 2 lignes // place le scrollpane a droite, sur la hauteur des 2 lignes
c.gridx = 1; c.gridx = 1;
c.gridy = 0; c.gridy = 0;
c.gridheight = 2; c.gridheight = 3;
c.fill = GridBagConstraints.BOTH; c.fill = GridBagConstraints.BOTH;
c.insets = new Insets(0, 0, 0, 0); c.insets = new Insets(0, 0, 0, 0);
c.weightx = 1.0; // prend la largeur dispo c.weightx = 1.0; // prend la largeur dispo
c.weighty = 1.0; // prend la hauteur dispo c.weighty = 1.0; // prend la hauteur dispo
body.add(scroll, c); body.add(scroll, c);
// barre en bas
JLabel txtbarre = new JLabel("-", SwingConstants.CENTER);
JPanel barre = new JPanel();
barre.add(txtbarre);
barre.setBorder(BorderFactory.createEmptyBorder(1,1,1,1));
// barre.setBackground(Color.GRAY);
// Conteneur racine // Conteneur racine
JPanel root = new JPanel(new BorderLayout()); JPanel root = new JPanel(new BorderLayout());
root.add(titre, BorderLayout.NORTH); root.add(titre, BorderLayout.NORTH);
root.add(body, BorderLayout.CENTER); root.add(body, BorderLayout.CENTER);
root.add(barre, BorderLayout.SOUTH);
setContentPane(root); setContentPane(root);
// Taille fixe // Taille fixe
@@ -76,23 +94,8 @@ public class Main extends JFrame {
} }
public List<PanelRappel> getPanelRpl(){
public void ouvrirFenetreAjout() { return listRpl;
FenetreAjout f = new FenetreAjout(this);
// cacher la fenetre actuelle et montrer celle d ajout
// récupère la position actuelle de Main
Point pos = this.getLocation();
f.setLocation(pos); // place FenetreAjout au même endroit
f.setVisible(true);
this.setVisible(false);
} }
public static void main(String[] args) {
Main f = new Main();
f.setVisible(true);
}
} }
+116
View File
@@ -0,0 +1,116 @@
// package fr.iutfbleau.papillon;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class PanelRappel extends JPanel implements ActionListener, MouseListener{
private final JLabel lbtitre;
private final JLabel lbcontenu;
private final Rappel r;
private final JPopupMenu menu;
private final JMenuItem itemOuvrir;
private boolean estSelectionne = false;
public PanelRappel(Rappel r){
super(new BorderLayout(2,0));
this.r = r;
lbtitre = new JLabel("["+r.getRang()+"] "+r.getTitre());
lbcontenu = new JLabel(r.getContenu());
this.setPreferredSize(new Dimension(70, 50));
this.setBackground(Color.CYAN);
this.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 2));
setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.NORTHWEST;
// --- Position du titre (en haut)
c.gridx = 0;
c.gridy = 0;
c.weightx = 1; // prend l'espace
c.fill = GridBagConstraints.NONE;
add(lbtitre, c);
// --- Position du contenu (en dessous)
c.gridx = 0;
c.gridy = 1;
c.weightx = 1;
c.fill = GridBagConstraints.NONE;
add(lbcontenu, c);
// --- Menu contextuel (clic droit) ---
menu = new JPopupMenu();
itemOuvrir = new JMenuItem("Ouvrir");
itemOuvrir.addActionListener(this);
menu.add(itemOuvrir);
// écouteur de souris ajouté ici
addMouseListener(this);
}
public boolean getSelection(){
return estSelectionne;
}
public int getId(){
return r.getId();
}
public Rappel getRappel(){
return r;
}
// ACTIONS
@Override
public void actionPerformed(ActionEvent e) {
Object src = e.getSource();
if (src == itemOuvrir) {
JOptionPane.showMessageDialog(
this,
"Ouverture du rappel : " + lbtitre.getText(),
"Ouvrir",
JOptionPane.INFORMATION_MESSAGE
);
}
}
@Override
public void mousePressed(MouseEvent e) {
if (e.isPopupTrigger()) {
menu.show(e.getComponent(), e.getX(), e.getY());
}else {
// clic gauche = sélection
estSelectionne = !estSelectionne;
if (estSelectionne) {
setBackground(Color.LIGHT_GRAY);
setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
} else {
setBackground(Color.CYAN);
setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 2));
}
repaint();
}
}
@Override
public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger()) {
menu.show(e.getComponent(), e.getX(), e.getY());
}
}
// Les autres méthodes sont obligatoires mais inutilisées ici
@Override public void mouseClicked(MouseEvent e) {}
@Override public void mouseEntered(MouseEvent e) {}
@Override public void mouseExited(MouseEvent e) {}
}
+66 -47
View File
@@ -1,48 +1,67 @@
// package fr.iutfbleau.papillon; public class Rappel {
private int id;
import javax.swing.*; private String titre;
import java.awt.*; private String contenu;
private String theme;
public class Rappel extends JPanel{ private int rang;
private final int ide = -1;
private final String titre = "loute"; public Rappel(String titre, String contenu, String theme, int rang) {
private final String contenu = "que veux tu"; this(0, titre, contenu, theme, rang);
private final String theme = ""; }
private final int rang = -1;
public Rappel(int id, String titre, String contenu, String theme, int rang) {
private final JLabel lbtitre; this.id = id;
private final JLabel lbcontenu; this.titre = titre;
this.contenu = contenu;
public Rappel(){ this.theme = theme;
super(new BorderLayout(2,0)); this.rang = rang;
}
lbtitre = new JLabel(titre);
lbcontenu = new JLabel(contenu); public int getId() {
return id;
this.setPreferredSize(new Dimension(70, 50)); }
this.setBackground(Color.CYAN); public void setId(int id) {
this.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 2)); this.id = id;
}
setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints(); public String getTitre() {
c.anchor = GridBagConstraints.NORTHWEST; return titre;
}
// --- Position du titre (en haut) public void setTitre(String titre) {
c.gridx = 0; this.titre = titre;
c.gridy = 0; }
c.weighty = 0; // ne prend pas l'espace
c.fill = GridBagConstraints.NONE; public String getContenu() {
add(lbtitre, c); return contenu;
}
public void setContenu(String contenu) {
// --- Position du contenu (en dessous) this.contenu = contenu;
c.gridx = 0; }
c.gridy = 1;
c.weighty = 0; public String getTheme() {
c.fill = GridBagConstraints.NONE; return theme;
add(lbcontenu, c); }
public void setTheme(String theme) {
this.theme = theme;
} }
public int getRang() {
return rang;
}
public void setRang(int rang) {
this.rang = rang;
}
// @Override
// public String toString() {
// @Override
// public String toString() {
// String texte = "[" + id + "] " + titre + " | " + theme + " | rang=" + rang + " | ";
// if (contenu != null) {
// texte = texte + contenu;
// }
// return texte;
// }
// }
} }
-67
View File
@@ -1,67 +0,0 @@
public class Rappel {
private int id;
private String titre;
private String contenu;
private String theme;
private int rang;
public Rappel(String titre, String contenu, String theme, int rang) {
this(0, titre, contenu, theme, rang);
}
public Rappel(int id, String titre, String contenu, String theme, int rang) {
this.id = id;
this.titre = titre;
this.contenu = contenu;
this.theme = theme;
this.rang = rang;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitre() {
return titre;
}
public void setTitre(String titre) {
this.titre = titre;
}
public String getContenu() {
return contenu;
}
public void setContenu(String contenu) {
this.contenu = contenu;
}
public String getTheme() {
return theme;
}
public void setTheme(String theme) {
this.theme = theme;
}
public int getRang() {
return rang;
}
public void setRang(int rang) {
this.rang = rang;
}
@Override
public String toString() {
@Override
public String toString() {
String texte = "[" + id + "] " + titre + " | " + theme + " | rang=" + rang + " | ";
if (contenu != null) {
texte = texte + contenu;
}
return texte;
}
}
}
+9
View File
@@ -0,0 +1,9 @@
import javax.swing.*;
import java.awt.*;
public class Start{
public static void main(String[] args) {
Main f = new Main();
f.setVisible(true);
}
}