Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.45 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.awt.*;
  3. import java.awt.event.*;
  4. public class Menu
  5. {
  6. String user;
  7. String pass;
  8. JFrame frame;
  9. JPanel panel;
  10. JLabel welcome;
  11. JLabel intro;
  12. JLabel name;
  13. JLabel accountNumber;
  14. JButton btnExit;
  15. JButton btnDeposit;
  16. JButton btnTransfer;
  17. JButton btnPayment;
  18. JButton btnSaldo;
  19. String theName;
  20. String theNumber;
  21. Database database;
  22.  
  23. public Menu (String name, String accNum, String username, String password, Database db)
  24. {
  25. user = username;
  26. pass = password;
  27. theName = name;
  28. theNumber = accNum;
  29. database = db;
  30. }
  31.  
  32. public void main(String[] args)
  33. {
  34. Menu gui = new Menu(theName, theNumber, user, pass, database);
  35. gui.go();
  36. }
  37. public void go(){
  38. frame = new JFrame("MENU PAGE");
  39. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  40. panel = new JPanel();
  41. welcome = new JLabel("SELAMAT DATANG");
  42. welcome.setFont(new Font("Calibri", Font.BOLD, 36));
  43. name = new JLabel();
  44. name.setFont(new Font("Calibri", Font.BOLD, 24));
  45. name.setText(theName);
  46. accountNumber = new JLabel();
  47. accountNumber.setFont(new Font("Calibri", Font.PLAIN, 24));
  48. accountNumber.setText(theNumber);
  49. intro = new JLabel("Silahkan pilih salah satu menu dibawah ini :");
  50. intro.setFont(new Font("Calibri", Font.PLAIN, 24));
  51. btnDeposit = new JButton("DEPOSIT");
  52. btnDeposit.setFont(new Font("Calibri", Font.PLAIN, 24));
  53. btnDeposit.addActionListener(new DepositListener());
  54. btnTransfer = new JButton("TRANSFER");
  55. btnTransfer.setFont(new Font("Calibri", Font.PLAIN, 24));
  56. btnTransfer.addActionListener(new TransferListener());
  57. btnPayment = new JButton("BAYAR");
  58. btnPayment.setFont(new Font("Calibri", Font.PLAIN, 24));
  59. btnPayment.addActionListener(new BayarListener());
  60. btnSaldo = new JButton("SALDO");
  61. btnSaldo.setFont(new Font("Calibri", Font.PLAIN, 24));
  62. btnSaldo.addActionListener(new SaldoListener());
  63. btnExit = new JButton("EXIT");
  64. btnExit.setFont(new Font("Calibri", Font.PLAIN, 24));
  65. btnExit.addActionListener(new ExitListener());
  66.  
  67. panel.setLayout(null);
  68. welcome.setBounds(10,10,500,50);
  69. name.setBounds(10,45,500,50);
  70. accountNumber.setBounds(10,70,500,50);
  71. intro.setBounds(10,100,500,50);
  72. btnSaldo.setBounds(10,150,150,80);
  73. btnDeposit.setBounds(260,150,150,80);
  74. btnTransfer.setBounds(10,240,150,80);
  75. btnPayment.setBounds(260,240,150,80);
  76. btnExit.setBounds(135,330,150,80);
  77.  
  78. panel.add(welcome);
  79. panel.add(name);
  80. panel.add(accountNumber);
  81. panel.add(intro);
  82. panel.add(btnSaldo);
  83. panel.add(btnDeposit);
  84. panel.add(btnTransfer);
  85. panel.add(btnPayment);
  86. panel.add(btnExit);
  87. frame.getContentPane().add(panel);
  88.  
  89. frame.setSize(500,500);
  90. frame.setVisible(true);
  91. }
  92.  
  93. public class ExitListener implements ActionListener{
  94. public void actionPerformed(ActionEvent event){
  95. frame.setVisible(false);
  96. }
  97. }
  98.  
  99. public class SaldoListener implements ActionListener{
  100. public void actionPerformed(ActionEvent event){
  101. Saldo saldo = new Saldo(theName, user, pass, theNumber, database);
  102. saldo.go();
  103. frame.setVisible(false);
  104. }
  105. }
  106.  
  107.  
  108. public class DepositListener implements ActionListener{
  109. public void actionPerformed(ActionEvent event){
  110. Deposit deposit = new Deposit(theName, user, pass, theNumber, database);
  111. deposit.go();
  112. frame.setVisible(false);
  113. }
  114. }
  115.  
  116. public class TransferListener implements ActionListener{
  117. public void actionPerformed(ActionEvent event){
  118. Transfer transfer = new Transfer(theName, user, pass, theNumber, database);
  119. transfer.go();
  120. frame.setVisible(false);
  121. }
  122. }
  123.  
  124. public class BayarListener implements ActionListener{
  125. public void actionPerformed(ActionEvent event){
  126. Bayar bayar = new Bayar(theName, user, pass, theNumber, database);
  127. bayar.go();
  128. frame.setVisible(false);
  129. }
  130. }
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement