comment on BillGUI
This commit is contained in:
parent
e245dcba52
commit
91320444a5
@ -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,15 +86,17 @@ 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){};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user