Skip to content
Commits on Source (2)
No preview for this file type
package fr.ldnr.herbert.miamle;
import enums.Meal;
import gui.MiammleGui;
import java.time.LocalDate;
import java.time.Month;
import java.util.logging.Level;
......@@ -15,6 +16,9 @@ import models.Inn;
public class MainClass {
public static void main(String[] args) {
MiammleGui gui = new MiammleGui("Miammle");
Inn inn = new Inn(LocalDate.of(2023, Month.APRIL, 12));
// Créer des participations
Attendance alf = new Attendance("Danlta", "Alphonse", "0123456789", 3, "");
......
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package gui;
import java.awt.Dimension;
import javax.swing.BorderFactory;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
/**
*
* @author stag
*/
public class CommentairePanel extends JScrollPane {
JTextArea commentaireArea;
/**
* Constructor.
*/
public CommentairePanel() {
commentaireArea = new JTextArea();
createGUI();
}
private void createGUI() {
commentaireArea.setLineWrap(true);
commentaireArea.setWrapStyleWord(true);
this.setViewportView(commentaireArea);
this.setBorder(BorderFactory.createTitledBorder("Commentaires"));
this.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
this.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
this.setPreferredSize(new Dimension(100, 75));
}
}
\ No newline at end of file
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package gui;
import java.awt.BorderLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
/**
*
* @author stag
*/
public class LabelAndField extends JPanel {
private JLabel label;
private JTextField textField;
public LabelAndField(String label, int size) {
this.label = new JLabel(label);
this.textField = new JTextField(size);
createGUI();
}
public LabelAndField(String label, int size, String toolTip) {
this(label, size);
this.textField.setToolTipText(toolTip);
}
private void createGUI() {
this.setLayout(new BorderLayout());
this.add(this.label, BorderLayout.WEST);
this.add(this.textField, BorderLayout.EAST);
}
public JTextField getTextField() {
return textField;
}
}
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package gui;
import java.awt.HeadlessException;
import javax.swing.Box;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
*
* @author stag
*/
public class MiammleGui extends JFrame {
JPanel formulaire;
JPanel affichage;
Box content;
public MiammleGui(String title) throws HeadlessException {
super(title);
this.content = Box.createVerticalBox();
this.formulaire = new formulaireUI();
this.affichage = new affichageUI();
this.createUI();
}
private void createUI(){
this.content.add(formulaire);
this.content.add(affichage);
this.getContentPane().add(content);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setResizable(false);
this.pack();
this.setLocationRelativeTo(null);
this.setVisible(true);
}
}
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package gui;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
/**
*
* @author stag
*/
public class affichageUI extends JPanel {
LabelAndField nomPanel, contactPanel;
JScrollPane commentaire;
public affichageUI() {
createUI();
}
private void createUI(){
this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
this.setBorder(BorderFactory.createTitledBorder("Affichage"));
nomPanel = new LabelAndField("Nom et prénom ", 25, "Entrez vos noms et prénoms");
contactPanel = new LabelAndField("Contact ", 25, "Entrez vote e-mail ou votre numéro de téléphone");
commentaire = new CommentairePanel();
this.add(nomPanel);
this.add(contactPanel);
this.add(commentaire);
}
}
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package gui;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
/**
*
* @author stag
*/
public class formulaireUI extends JPanel {
public formulaireUI() {
createUI();
}
private void createUI(){
this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
this.setBorder(BorderFactory.createTitledBorder("Formulaire"));
}
}