Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.awt.*;
- import java.awt.event.*;
- public class Menu
- {
- String user;
- String pass;
- JFrame frame;
- JPanel panel;
- JLabel welcome;
- JLabel intro;
- JLabel name;
- JLabel accountNumber;
- JButton btnExit;
- JButton btnDeposit;
- JButton btnTransfer;
- JButton btnPayment;
- JButton btnSaldo;
- String theName;
- String theNumber;
- Database database;
- public Menu (String name, String accNum, String username, String password, Database db)
- {
- user = username;
- pass = password;
- theName = name;
- theNumber = accNum;
- database = db;
- }
- public void main(String[] args)
- {
- Menu gui = new Menu(theName, theNumber, user, pass, database);
- gui.go();
- }
- public void go(){
- frame = new JFrame("MENU PAGE");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- panel = new JPanel();
- welcome = new JLabel("SELAMAT DATANG");
- welcome.setFont(new Font("Calibri", Font.BOLD, 36));
- name = new JLabel();
- name.setFont(new Font("Calibri", Font.BOLD, 24));
- name.setText(theName);
- accountNumber = new JLabel();
- accountNumber.setFont(new Font("Calibri", Font.PLAIN, 24));
- accountNumber.setText(theNumber);
- intro = new JLabel("Silahkan pilih salah satu menu dibawah ini :");
- intro.setFont(new Font("Calibri", Font.PLAIN, 24));
- btnDeposit = new JButton("DEPOSIT");
- btnDeposit.setFont(new Font("Calibri", Font.PLAIN, 24));
- btnDeposit.addActionListener(new DepositListener());
- btnTransfer = new JButton("TRANSFER");
- btnTransfer.setFont(new Font("Calibri", Font.PLAIN, 24));
- btnTransfer.addActionListener(new TransferListener());
- btnPayment = new JButton("BAYAR");
- btnPayment.setFont(new Font("Calibri", Font.PLAIN, 24));
- btnPayment.addActionListener(new BayarListener());
- btnSaldo = new JButton("SALDO");
- btnSaldo.setFont(new Font("Calibri", Font.PLAIN, 24));
- btnSaldo.addActionListener(new SaldoListener());
- btnExit = new JButton("EXIT");
- btnExit.setFont(new Font("Calibri", Font.PLAIN, 24));
- btnExit.addActionListener(new ExitListener());
- panel.setLayout(null);
- welcome.setBounds(10,10,500,50);
- name.setBounds(10,45,500,50);
- accountNumber.setBounds(10,70,500,50);
- intro.setBounds(10,100,500,50);
- btnSaldo.setBounds(10,150,150,80);
- btnDeposit.setBounds(260,150,150,80);
- btnTransfer.setBounds(10,240,150,80);
- btnPayment.setBounds(260,240,150,80);
- btnExit.setBounds(135,330,150,80);
- panel.add(welcome);
- panel.add(name);
- panel.add(accountNumber);
- panel.add(intro);
- panel.add(btnSaldo);
- panel.add(btnDeposit);
- panel.add(btnTransfer);
- panel.add(btnPayment);
- panel.add(btnExit);
- frame.getContentPane().add(panel);
- frame.setSize(500,500);
- frame.setVisible(true);
- }
- public class ExitListener implements ActionListener{
- public void actionPerformed(ActionEvent event){
- frame.setVisible(false);
- }
- }
- public class SaldoListener implements ActionListener{
- public void actionPerformed(ActionEvent event){
- Saldo saldo = new Saldo(theName, user, pass, theNumber, database);
- saldo.go();
- frame.setVisible(false);
- }
- }
- public class DepositListener implements ActionListener{
- public void actionPerformed(ActionEvent event){
- Deposit deposit = new Deposit(theName, user, pass, theNumber, database);
- deposit.go();
- frame.setVisible(false);
- }
- }
- public class TransferListener implements ActionListener{
- public void actionPerformed(ActionEvent event){
- Transfer transfer = new Transfer(theName, user, pass, theNumber, database);
- transfer.go();
- frame.setVisible(false);
- }
- }
- public class BayarListener implements ActionListener{
- public void actionPerformed(ActionEvent event){
- Bayar bayar = new Bayar(theName, user, pass, theNumber, database);
- bayar.go();
- frame.setVisible(false);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement