-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGUIReceipt.java
More file actions
41 lines (35 loc) · 943 Bytes
/
GUIReceipt.java
File metadata and controls
41 lines (35 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package Koebmand;
import javax.swing.JFrame;
import javax.swing.JTable;
public class GUIReceipt
{
private JFrame jf = new JFrame();
private JTable jt = new JTable();
private Receipt rt = new Receipt();
private Storage stored = new Storage();
public GUIReceipt()
{
}
//Make the GUI for receipt.
public void makeGUI()
{
String[] columName = { "ID", "Item", "Quantity", "Price" };
String[] dataLine = new String[]();
Object[][] data = new Object[][];
rt.addAll(stored.getList());
for(Goods st : rt.getReceipt()) //Adds text to StringArray
{
dataLine.removeAll();
dataLine.add(st.getID().toString());
dataLine.add(st.getName);
dataLine.add(st.getQuantity().toString());
dataLine.add((st.getPrice()).toString());
data.add(dataLine);
}
jt.add(data);
jf.add(jt);
jf.setVisible(true);
jf.setSize(500, 500);
jf.setResizable(false);
}
}