Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1.  
  2. // nomor limaaaa
  3.  
  4. package testest;
  5.  
  6. import java.awt.BorderLayout;
  7. import java.awt.Component;
  8. import java.awt.Dimension;
  9. import java.awt.GridLayout;
  10. import java.awt.event.ActionEvent;
  11. import java.awt.event.ActionListener;
  12. import java.awt.event.MouseEvent;
  13. import java.util.Vector;
  14.  
  15. import javax.swing.JFrame;
  16. import javax.swing.JLabel;
  17. import javax.swing.JPanel;
  18. import javax.swing.JScrollPane;
  19. import javax.swing.JSpinner;
  20. import javax.swing.JTable;
  21. import javax.swing.SpinnerModel;
  22. import javax.swing.SpinnerNumberModel;
  23. import javax.swing.table.DefaultTableModel;
  24. import javax.swing.table.TableCellRenderer;
  25. import javax.swing.table.TableColumnModel;
  26.  
  27. public class NoLima extends JFrame implements ActionListener{
  28.  
  29. JPanel panelHeaderTransactionHistory, panelContentTransactionHistory, panelFooterTransactionHistory;
  30. JLabel lblTitle;
  31. JTable table;
  32. JFrame TransactionHistory;
  33. Vector tableHeader;
  34. Vector<Vector> tableContent;
  35. DefaultTableModel model;
  36.  
  37. void TransactionHistory() {
  38. TransactionHistory = new JFrame();
  39.  
  40. panelHeaderTransactionHistory = new JPanel();
  41. panelContentTransactionHistory = new JPanel();
  42. panelFooterTransactionHistory = new JPanel();
  43.  
  44. //header
  45. lblTitle = new JLabel("Transaction History");
  46. panelHeaderTransactionHistory.add(lblTitle);
  47.  
  48. //content
  49. tableHeader = new Vector();
  50. tableHeader.add("TransactionID");
  51. tableHeader.add("Clothes Name");
  52. tableHeader.add("Clothes Type");
  53. tableHeader.add("Brand");
  54. tableHeader.add("Transaction Date");
  55. tableHeader.add("Quantity");
  56. tableHeader.add("Price");
  57. tableHeader.add("Status");
  58.  
  59.  
  60.  
  61. tableContent = new Vector();
  62. model = new DefaultTableModel(tableContent, tableHeader);
  63. JTable table = new JTable(model);
  64.  
  65. table = new JTable();
  66. table.setModel(model);
  67.  
  68. JScrollPane scroll = new JScrollPane(table);
  69. panelContentTransactionHistory.add(scroll);
  70. scroll.setPreferredSize(new Dimension(900,950));
  71.  
  72. GridLayout experimentLayout = new GridLayout(0,2);
  73. panelFooterTransactionHistory.setLayout(experimentLayout);
  74.  
  75.  
  76. TransactionHistory.add(panelHeaderTransactionHistory, BorderLayout.NORTH);
  77. TransactionHistory.add(panelContentTransactionHistory, BorderLayout.CENTER);
  78. TransactionHistory.add(panelFooterTransactionHistory, BorderLayout.SOUTH);
  79.  
  80. TransactionHistory.setSize(900,950);
  81. TransactionHistory.setTitle("Transaction History");
  82. TransactionHistory.setDefaultCloseOperation(EXIT_ON_CLOSE);
  83. TransactionHistory.setVisible(true);
  84. TransactionHistory.setLocationRelativeTo(null);
  85. panelContentTransactionHistory.setSize(100,100);
  86. }
  87.  
  88.  
  89.  
  90. public NoLima() {
  91. TransactionHistory();
  92. }
  93.  
  94. public static void main(String[] args) {
  95. new NoLima();
  96. }
  97.  
  98.  
  99. @Override
  100. public void actionPerformed(ActionEvent arg0) {
  101. // TODO Auto-generated method stub
  102.  
  103. }
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement