-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathListStockControl.java
More file actions
37 lines (28 loc) · 942 Bytes
/
ListStockControl.java
File metadata and controls
37 lines (28 loc) · 942 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
//control the displaying stock list
import javax.swing.table.DefaultTableModel;
import java.awt.EventQueue;
public class ListStockControl {
private ListStockScreen window2;
public ListStockControl() {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
window2 = new ListStockScreen();
window2.frame3.setVisible(true);
addToTable();
}
catch (Exception e) {
e.printStackTrace();
}
}
});
}
//add all stock item details in to the table
private void addToTable(){
DefaultTableModel allitems = (DefaultTableModel)window2.gettable_stockList().getModel();
for (StockUnit itemArray_stock : StockDB.getValues()) {
Object[] newRow = {itemArray_stock.getSymbol(), itemArray_stock.getSecurityName(), itemArray_stock.getPrice()};
allitems.addRow(newRow);
}
}
}