Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.47 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.awt.*;
  3. import java.awt.event.*;
  4. public class Saldo
  5. {
  6. String nama;
  7. String usernama;
  8. String passkata;
  9. String angka;
  10. JFrame frame;
  11. JPanel panel;
  12. JLabel temp1, temp2, temp3, temp4, temp5;
  13. JLabel intro;
  14. JLabel username;
  15. JLabel name;
  16. JLabel nomor;
  17. JLabel saldo;
  18. JButton btnBack;
  19. Database database;
  20. int money;
  21.  
  22. public Saldo (String nam, String usr, String pwd, String num, Database db)
  23. {
  24. nama = nam;
  25. usernama = usr;
  26. passkata = pwd;
  27. angka = num;
  28. database = db;
  29. }
  30.  
  31. public void main(String[] args)
  32. {
  33. Saldo gui = new Saldo(nama, usernama, passkata, angka, database);
  34. gui.go();
  35. }
  36. public void go(){
  37. frame = new JFrame("HALAMAN SALDO");
  38. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  39. panel = new JPanel();
  40.  
  41. money = database.getAvailableBalance(usernama, passkata);
  42.  
  43. intro = new JLabel("CEK SALDO");
  44. intro.setFont(new Font("Calibri", Font.BOLD, 32));
  45. temp1 = new JLabel("Nama : ");
  46. temp1.setFont(new Font("Calibri", Font.BOLD, 24));
  47. name = new JLabel();
  48. name.setFont(new Font("Calibri", Font.PLAIN, 24));
  49. name.setText(nama);
  50. temp2 = new JLabel("Username : ");
  51. temp2.setFont(new Font("Calibri", Font.BOLD, 24));
  52. username = new JLabel();
  53. username.setFont(new Font("Calibri", Font.PLAIN, 24));
  54. username.setText(usernama);
  55. temp3 = new JLabel("No. Akun : ");
  56. temp3.setFont(new Font("Calibri", Font.BOLD, 24));
  57. nomor = new JLabel();
  58. nomor.setFont(new Font("Calibri", Font.PLAIN, 24));
  59. nomor.setText(angka);
  60. temp4 = new JLabel("Saldo Anda adalah : ");
  61. temp4.setFont(new Font("Calibri", Font.PLAIN, 24));
  62. temp5 = new JLabel("Rp.");
  63. temp5.setFont(new Font("Calibri", Font.PLAIN, 24));
  64. saldo = new JLabel();
  65. saldo.setFont(new Font("Calibri", Font.PLAIN, 24));
  66. saldo.setText(String.valueOf(money));
  67. btnBack = new JButton("BACK");
  68. btnBack.setFont(new Font("Calibri", Font.PLAIN, 20));
  69. btnBack.addActionListener(new BackListener());
  70.  
  71. panel.setLayout(null);
  72. intro.setBounds(10,1,500,120);
  73. temp1.setBounds(10,70,500,80);
  74. name.setBounds(150,70,500,80);
  75. temp2.setBounds(10,110,500,80);
  76. username.setBounds(150,110,500,80);
  77. temp3.setBounds(10,150,500,80);
  78. nomor.setBounds(150,150,500,80);
  79. temp4.setBounds(10,210,500,80);
  80. temp5.setBounds(10,240,150,80);
  81. saldo.setBounds(50,240,500,80);
  82. btnBack.setBounds(135,330,150,80);
  83.  
  84. panel.add(intro);
  85. panel.add(temp1);
  86. panel.add(name);
  87. panel.add(temp2);
  88. panel.add(username);
  89. panel.add(temp3);
  90. panel.add(nomor);
  91. panel.add(temp4);
  92. panel.add(temp5);
  93. panel.add(saldo);
  94. panel.add(btnBack);
  95. frame.getContentPane().add(panel);
  96.  
  97. frame.setSize(500,500);
  98. frame.setVisible(true);
  99. }
  100.  
  101. public class BackListener implements ActionListener{
  102. public void actionPerformed(ActionEvent event){
  103. Menu menu = new Menu(nama, angka, usernama, passkata, database);
  104. menu.go();
  105. frame.setVisible(false);
  106. }
  107. }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement