commit
3a01bb88d4
14
.vscode/launch.json
vendored
14
.vscode/launch.json
vendored
@ -1,5 +1,19 @@
|
|||||||
{
|
{
|
||||||
"configurations": [
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "Launch GUI2",
|
||||||
|
"request": "launch",
|
||||||
|
"mainClass": "GUI.GUI2",
|
||||||
|
"projectName": "Lab15_OOP_79fdc875"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "Launch GUI1",
|
||||||
|
"request": "launch",
|
||||||
|
"mainClass": "GUI.GUI1",
|
||||||
|
"projectName": "Lab15_OOP_79fdc875"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "java",
|
"type": "java",
|
||||||
"name": "Launch HesSoGarage",
|
"name": "Launch HesSoGarage",
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,10 +6,17 @@ import javax.swing.*;
|
|||||||
import java.awt.print.*;
|
import java.awt.print.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* generate the bill in a window
|
||||||
|
*/
|
||||||
public class BillGui extends JFrame{
|
public class BillGui extends JFrame{
|
||||||
String bill;
|
String bill;
|
||||||
JPanel jP;
|
JPanel jP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* initialize the bill in a window
|
||||||
|
* @param bill string who contains the bill
|
||||||
|
*/
|
||||||
BillGui(String bill){
|
BillGui(String bill){
|
||||||
this.bill = bill;
|
this.bill = bill;
|
||||||
|
|
||||||
@ -20,17 +27,19 @@ public class BillGui extends JFrame{
|
|||||||
FlowLayout fl = new FlowLayout();
|
FlowLayout fl = new FlowLayout();
|
||||||
this.setLayout(fl);
|
this.setLayout(fl);
|
||||||
|
|
||||||
|
//Create the label who contain the label with the bill
|
||||||
jP = new JPanel();
|
jP = new JPanel();
|
||||||
|
|
||||||
JLabel jBill = new JLabel(bill);
|
JLabel jBill = new JLabel(bill);
|
||||||
jP.add(jBill);
|
jP.add(jBill);
|
||||||
|
|
||||||
this.add(jP);
|
this.add(jP);
|
||||||
|
|
||||||
|
//Create the button for print the bill
|
||||||
JButton buttonPrint = new JButton("Print");
|
JButton buttonPrint = new JButton("Print");
|
||||||
buttonPrint.addActionListener(
|
buttonPrint.addActionListener(new ButtonListenerBill(this) {
|
||||||
|
//TODO : describe the prozess to print and resize the bill
|
||||||
new ButtonListenerBill(this) {
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e){
|
public void actionPerformed(ActionEvent e){
|
||||||
|
|
||||||
@ -77,17 +86,19 @@ public class BillGui extends JFrame{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* listener to detect the button to print the bill
|
||||||
*/
|
*/
|
||||||
class ButtonListenerBill implements ActionListener {
|
class ButtonListenerBill implements ActionListener {
|
||||||
JFrame Jf;
|
JFrame Jf;
|
||||||
|
/**
|
||||||
|
* initialize the listener
|
||||||
|
* @param Jf //TODO : do we always use the JFrame ?
|
||||||
|
*/
|
||||||
ButtonListenerBill(JFrame Jf){
|
ButtonListenerBill(JFrame Jf){
|
||||||
this.Jf = Jf;
|
this.Jf = Jf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e){ };
|
public void actionPerformed(ActionEvent e){};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,9 +2,11 @@ package BillGUI;
|
|||||||
|
|
||||||
public class HesSoGarage {
|
public class HesSoGarage {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
//Create a new garage
|
||||||
GarageManager garageManager = new GarageManager();
|
GarageManager garageManager = new GarageManager();
|
||||||
String name = "<html><body><i>Garage manager</i><br>Prestations</body></html>";
|
String name = "<html><body><i>Garage manager</i><br>Prestations</body></html>";
|
||||||
String logoFilePath = "src/logo_garage.png"; //TODO redimensionnement automatique
|
String logoFilePath = "src/logo_garage.png"; //TODO redimensionnement automatique
|
||||||
|
//Create a new HMI for calculate and print the bill
|
||||||
new ManagerGui(name, logoFilePath, garageManager.getServices(), garageManager); //TODO affichage sans redimensionnement
|
new ManagerGui(name, logoFilePath, garageManager.getServices(), garageManager); //TODO affichage sans redimensionnement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import java.util.Vector;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* HMI for calculate the bill
|
||||||
*/
|
*/
|
||||||
public class ManagerGui extends JFrame {
|
public class ManagerGui extends JFrame {
|
||||||
GridLayout grid;
|
GridLayout grid;
|
||||||
@ -22,13 +22,17 @@ public class ManagerGui extends JFrame {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* initialize the window
|
||||||
|
* @param name name of the garage
|
||||||
|
* @param logoFilePath file of the garage's logo
|
||||||
|
* @param prestationsName array with the name of the prestations
|
||||||
|
* @param garageManager a new garage application
|
||||||
*/
|
*/
|
||||||
public ManagerGui(String name, String logoFilePath, String[] prestationsName, GarageManager garageManager){
|
public ManagerGui(String name, String logoFilePath, String[] prestationsName, GarageManager garageManager){
|
||||||
|
//set up the window with the layout
|
||||||
this.setSize(400,600);
|
this.setSize(400,600);
|
||||||
this.setLocation(600,200);
|
this.setLocation(600,200);
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
|
|
||||||
grid = new GridLayout(prestationsName.length + 2,2);
|
grid = new GridLayout(prestationsName.length + 2,2);
|
||||||
this.setLayout(grid);
|
this.setLayout(grid);
|
||||||
|
|
||||||
@ -39,7 +43,6 @@ public class ManagerGui extends JFrame {
|
|||||||
this.add(Jname);
|
this.add(Jname);
|
||||||
this.add(Jlogo);
|
this.add(Jlogo);
|
||||||
|
|
||||||
|
|
||||||
//Create rows for prestations
|
//Create rows for prestations
|
||||||
for(String s : prestationsName){
|
for(String s : prestationsName){
|
||||||
prestations.add(new Row(s));
|
prestations.add(new Row(s));
|
||||||
@ -54,7 +57,7 @@ public class ManagerGui extends JFrame {
|
|||||||
JButton buttonBill = new JButton(buttonNameBill);
|
JButton buttonBill = new JButton(buttonNameBill);
|
||||||
buttonBill.addActionListener(new ButtonListenerManager(valuePrestations, prestations, garageManager){
|
buttonBill.addActionListener(new ButtonListenerManager(valuePrestations, prestations, garageManager){
|
||||||
/**
|
/**
|
||||||
*
|
* add the number of prestations when it is used
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e){
|
public void actionPerformed(ActionEvent e){
|
||||||
@ -66,7 +69,7 @@ public class ManagerGui extends JFrame {
|
|||||||
}
|
}
|
||||||
System.out.println(value);
|
System.out.println(value);
|
||||||
}
|
}
|
||||||
|
//Create the bill
|
||||||
new BillGui(garageManager.generateHTMLBill(valuePrestations));
|
new BillGui(garageManager.generateHTMLBill(valuePrestations));
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@ -74,7 +77,7 @@ public class ManagerGui extends JFrame {
|
|||||||
JButton buttonQuit = new JButton(buttonNameQuit);
|
JButton buttonQuit = new JButton(buttonNameQuit);
|
||||||
buttonQuit.addActionListener(new ButtonListenerManager(this){
|
buttonQuit.addActionListener(new ButtonListenerManager(this){
|
||||||
/**
|
/**
|
||||||
*
|
* quit the window
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e){
|
public void actionPerformed(ActionEvent e){
|
||||||
@ -84,18 +87,16 @@ public class ManagerGui extends JFrame {
|
|||||||
|
|
||||||
this.add(buttonBill);
|
this.add(buttonBill);
|
||||||
this.add(buttonQuit);
|
this.add(buttonQuit);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Create a row in the windows with a label and a spinner
|
||||||
*/
|
*/
|
||||||
class Row {
|
class Row {
|
||||||
JLabel label;
|
JLabel label;
|
||||||
JSpinner spinner;
|
JSpinner spinner;
|
||||||
|
|
||||||
Row(String title){
|
Row(String title){
|
||||||
label = new JLabel(title);
|
label = new JLabel(title);
|
||||||
spinner = new JSpinner();
|
spinner = new JSpinner();
|
||||||
@ -103,7 +104,7 @@ class Row {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* listener for detect the button
|
||||||
*/
|
*/
|
||||||
class ButtonListenerManager implements ActionListener {
|
class ButtonListenerManager implements ActionListener {
|
||||||
JFrame Jf;
|
JFrame Jf;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
package GUI;
|
package GUI;
|
||||||
//TODO mettre commentaire
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
package GUI;
|
package GUI;
|
||||||
//TODO mettre commentaire
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
|
Reference in New Issue
Block a user