Co-authored-by: Rémi Heredero <Klagarge@users.noreply.github.com>
This commit is contained in:
parent
fa5dca6196
commit
a156a87733
7
.vscode/launch.json
vendored
7
.vscode/launch.json
vendored
@ -1,5 +1,12 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Launch HesSoGarage",
|
||||
"request": "launch",
|
||||
"mainClass": "BillGUI.HesSoGarage",
|
||||
"projectName": "Lab15_OOP_79fdc875"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Launch GUI2",
|
||||
|
Binary file not shown.
BIN
bin/BillGUI/HesSoGarage.class
Normal file
BIN
bin/BillGUI/HesSoGarage.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
bin/BillGUI/Row.class
Normal file
BIN
bin/BillGUI/Row.class
Normal file
Binary file not shown.
@ -1,11 +0,0 @@
|
||||
package BillGUI;
|
||||
|
||||
public class App {
|
||||
public static void main(String[] args) {
|
||||
int rows = 9;
|
||||
int cols = 2;
|
||||
String name = "Garage manager \n Prestations";
|
||||
String logoFilePath = "src/logo_garage.png";
|
||||
new ManagerGui(rows, cols, name, logoFilePath);
|
||||
}
|
||||
}
|
12
src/BillGUI/HesSoGarage.java
Normal file
12
src/BillGUI/HesSoGarage.java
Normal file
@ -0,0 +1,12 @@
|
||||
package BillGUI;
|
||||
|
||||
public class HesSoGarage {
|
||||
public static void main(String[] args) {
|
||||
GarageManager garageManager = new GarageManager();
|
||||
ManagerGui managerGui;
|
||||
String name = "<em>Garage manager</em> <br> Prestations";
|
||||
String logoFilePath = "src/logo_garage.png";
|
||||
managerGui = new ManagerGui(name, logoFilePath, garageManager.getServices());
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package BillGUI;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.Vector;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
@ -11,13 +12,62 @@ public class ManagerGui extends JFrame{
|
||||
GridLayout grid;
|
||||
JLabel Jname;
|
||||
JLabel Jlogo;
|
||||
ImageIcon logo;
|
||||
|
||||
Vector<Row> prestations = new Vector<>();
|
||||
|
||||
|
||||
public ManagerGui(int n,int m, String name, String logoFilePath){
|
||||
grid = new GridLayout(n,m);
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ManagerGui(String name, String logoFilePath, String[] prestationsName){
|
||||
this.setSize(400,600);
|
||||
this.setLocation(600,200);
|
||||
this.setVisible(true);
|
||||
|
||||
grid = new GridLayout(prestationsName.length + 2,2);
|
||||
this.setLayout(grid);
|
||||
|
||||
//Create and add header
|
||||
logo = new ImageIcon(logoFilePath);
|
||||
Jlogo = new JLabel(name);
|
||||
Jname = new JLabel(name);
|
||||
this.add(Jname);
|
||||
this.add(Jlogo);
|
||||
|
||||
|
||||
//Create rows for prestations
|
||||
for(String s : prestationsName){
|
||||
prestations.add(new Row(s));
|
||||
|
||||
}
|
||||
//add rows on the Jframe
|
||||
for(Row r : prestations){
|
||||
this.add(r.label);
|
||||
this.add(r.spinner);
|
||||
}
|
||||
|
||||
//Create and add button
|
||||
JButton ButtonBill = new JButton();
|
||||
JButton ButtonQuit = new JButton();
|
||||
this.add(ButtonBill);
|
||||
this.add(ButtonQuit);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Row {
|
||||
JLabel label;
|
||||
JSpinner spinner;
|
||||
|
||||
Row(String title){
|
||||
label = new JLabel(title);
|
||||
spinner = new JSpinner();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user