-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTableGUI.java
More file actions
46 lines (33 loc) · 994 Bytes
/
TableGUI.java
File metadata and controls
46 lines (33 loc) · 994 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
42
43
44
45
46
package ac.shenkar.Calc;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.table.*;
//Table GUI not for use.. only show data on windows
public class TableGUI {
private JFrame frame;
private JPanel panel;
public TableGUI(CurrencyTable _currTable){
frame=new JFrame();
frame.setSize(400, 700);
panel=new JPanel();
panel.add(buildTable(_currTable));
frame.add(panel);
panel.setVisible(true);
}
private JTable buildTable(CurrencyTable _currTable){
JTable table;
DefaultTableModel model=new DefaultTableModel(_currTable.getTable(),new Object[]{"Code","Rate","Change"});
table=new JTable(model);
table.setFont(new Font("Arial", Font.PLAIN, 22));
table.setBackground(new Color(222,222,222));
table.setRowHeight(40);
table.setShowGrid(false);
for (int i=0;i<table.getColumnCount();i++)
table.getColumnModel().getColumn(i).setPreferredWidth(120);
return table;
}
JFrame getFrame(){
return frame;
}
}