Question

I need to make a GUI in java with swing, that is from a bank system...

I need to make a GUI in java with swing, that is from a bank system that has the following aspect:
Administrative module:
✓ Login Password
✓ Creation, search, edition and elimination of clients.
✓ Creation, search, edition and elimination of banking agencies.
✓ Creation, search, edition and elimination of bank branches with autobanking.
✓ Creation, search, edition and elimination of ATMs.
✓ Authorization or rejection of credit card applications.
✓ Authorization or rejection of loan applications

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Banking System GUI:

This is just an example of a Banking System GUI in which we can enter the name, account number and its corresponding details. We can deposit and withdraw from our account. You can add you're appropriate administrative module instead of the withdraw and deposit modules. I will also add another program which could help you about creating an account in the bank, depositing and withdrawing, applying for a loan and a creating a fixed deposit account. Hope I was helpful.

import java.text.NumberFormat;

public class Account

{

private final double RATE = 0.035; // interest rate of 3.5%

private final double FEE = 1.00;

private long acctNumber;

private double balance;

private String name;

// Sets up the account by defining its owner, account number, and initial balance.

public Account(String owner, long account, double initial)

{

name = "ABCD";

acctNumber = 12345;

balance = 100.00;

}

// Deposits the specified amount into the account. Returns the

// new balance.

public double deposit(double amount)

{

balance = balance + amount;

return balance;

}

// Withdraws the specified amount from the account and applies the fee. Returns the new balance.

public double withdraw(double amount, double fee)

{

balance = balance - amount - fee;

return balance;

}

// Adds interest to the account and returns the new balance.

public double addInterest()

{

balance += (balance * RATE);

return balance;

}

// Returns the current balance of the account.

public double getBalance()

{

return balance;

}

public String getName()

{

return name;

}

public long getNumber()

{

return acctNumber;

}

//-----------------------------------------------------------------

// Returns a one-line description of the account as a string.

//-----------------------------------------------------------------

public String toString()

{

NumberFormat fmt = NumberFormat.getCurrencyInstance();

return (acctNumber + "\t" + name + "\t" + fmt.format(balance));

}

}

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.util.Scanner;

public class BankAccount

implements ActionListener

{

private JTextField acctNumber;

private JLabel numberOutput;

private JTextField acctName;

private JLabel nameOutput;

private JTextField acctBalance;

private JLabel balanceOutput;

private JTextField depositAmount;

private JTextField withdrawAmount;

private JButton withdrawButton;

private JButton depositButton;

public BankAccount()

{

JFrame frame = new JFrame ("Account Information");

frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);

frame.getContentPane().add(makePanel());

frame.pack();

frame.setVisible(true);

}

private JPanel makePanel()

{

JPanel panel = new JPanel();

panel.add (new JLabel ("Account Number"));

acctNumber = new JTextField();

panel.add(acctNumber);

panel.add (new JLabel ("Account Name"));

acctName = new JTextField();

panel.add(acctName);

panel.add (new JLabel ("Account Balance"));

acctBalance = new JTextField(6);

panel.add(acctBalance);

this.acctName.setText(account.getName());

this.acctNumber.setText("" + account.getNumber());

this.acctBalance.setText("" + account.getBalance());

JButton withdrawButton = new JButton ("Withdraw:");

withdrawAmount = new JTextField(10);

panel.add (withdrawButton);

panel.add (withdrawAmount);

withdrawButton.addActionListener(this);

JButton depositButton = new JButton ("Deposit:");

depositAmount = new JTextField(10);

panel.add (depositButton);

panel.add (depositAmount);

depositButton.addActionListener(this);

panel.setPreferredSize(new Dimension(600,200));

panel.setBackground(Color.yellow);

return panel;

}

public void actionPerformed (ActionEvent event)

{

if (event.getSource() == withdrawButton)

{

double amount = Double.parseDouble(withdrawAmount.getText());

account.withdraw(amount, 1.00);

acctBalance.setText(Double.toString(account.getBalance()));

}

}

private Account account;

{

account = new Account("John Doe",12345,100.00);

}

public static void main (String[] args)

{

new BankAccount();

}

}

Alternative:

//Creating an account

//Check the output and make corresponding changes for your module

import javax.swing.*;

public class home extends javax.swing.JFrame

{

String name,acc_type;

int Acc_num,Acc_Balance;

JOptionPane JOptionPane1;

public home()

{

initComponents();

}

void create_account(String n,int acc_num,int b,String a_t)

{

name=n;

Acc_num=acc_num;

Acc_Balance=b;

acc_type=a_t;

}

void deposit(int acct, int deposit)

{

Acc_num = acct;

Acc_Balance = deposit;

}

int Accnum()

{

return Acc_num;

}

void display()

{

System.out.println(this.name);

}

@SuppressWarnings(“unchecked”)

// the following code is already in the NetBeans

private void initComponents()

{

create = new javax.swing.JButton();

deposit = new javax.swing.JButton();

withdraw = new javax.swing.JButton();

check = new javax.swing.JButton();

display = new javax.swing.JButton();

Apply = new javax.swing.JButton();

open = new javax.swing.JButton();

jLabel1 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

create.setText(“Create Account”);

create.addActionListener(new java.awt.event.ActionListener()

{

public void actionPerformed(java.awt.event.ActionEvent evt)

{

createActionPerformed(evt);

}

});

deposit.setText(“Deposit Money”);

deposit.addActionListener(new java.awt.event.ActionListener()

{

public void actionPerformed(java.awt.event.ActionEvent evt)

{

depositActionPerformed(evt);

}

});

withdraw.setText(“Withdraw Money”);

withdraw.addActionListener(new java.awt.event.ActionListener()

{

public void actionPerformed(java.awt.event.ActionEvent evt)

{

withdrawActionPerformed(evt);

}

});

check.setText(“Check Balance”);

check.addActionListener(new java.awt.event.ActionListener()

{

public void actionPerformed(java.awt.event.ActionEvent evt)

{

checkActionPerformed(evt);

}

});

display.setText(“Display Account Details”);

display.addActionListener(new java.awt.event.ActionListener()

{

public void actionPerformed(java.awt.event.ActionEvent evt)

{

displayActionPerformed(evt);

}

});

Apply.setText(“Apply for loan”);

Apply.addActionListener(new java.awt.event.ActionListener()

{

public void actionPerformed(java.awt.event.ActionEvent evt)

{

ApplyActionPerformed(evt);

}

});

open.setText(“Open Fix Deposit Account”);

open.addActionListener(new java.awt.event.ActionListener()

{

public void actionPerformed(java.awt.event.ActionEvent evt)

{

openActionPerformed(evt);

}

});

jLabel1.setIcon(new javax.swing.ImageIcon(“C:\\Users\\HP\\Desktop\\banklog(1).jpg”));

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(44, 44, 44)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)

.addComponent(create, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(withdraw, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addGap(381, 381, 381)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(Apply)

.addComponent(check))

.addContainerGap(77, Short.MAX_VALUE))

.addGroup(layout.createSequentialGroup()

.addComponent(deposit)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(display)

.addGap(55, 55, 55))))

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(267, 267, 267)

.addComponent(open))

.addGroup(layout.createSequentialGroup()

.addGap(259, 259, 259)

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE)))

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(create, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(check))

.addGap(21, 21, 21)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(display)

.addComponent(deposit))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(open)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(withdraw)

.addComponent(Apply))

.addGap(70, 70, 70))

);

pack();

}

private void depositActionPerformed(java.awt.event.ActionEvent evt) {

javax.swing.JTextField acctnum = new javax.swing.JTextField(15);

javax.swing.JTextField amount = new javax.swing.JTextField(15);

javax.swing.JPanel myPanel = new javax.swing.JPanel();

myPanel.add(new JLabel(“Account Number”));

myPanel.add(acctnum);

myPanel.add(Box.createVerticalStrut(10));

myPanel.add(new JLabel(“Amount To Deposit”));

myPanel.add(amount);

int result = JOptionPane.showConfirmDialog(null, myPanel,“Deposit Money”, JOptionPane.OK_CANCEL_OPTION);

if (result == JOptionPane.OK_OPTION)

{

int Acct = Integer.parseInt(acctnum.getText());

int deposits = Integer.parseInt(amount.getText());

deposit(Acct,deposits);

}

else

JOptionPane1.showMessageDialog(this,”Kindly enter Account Number and press OK”);

}

private void createActionPerformed(java.awt.event.ActionEvent evt) {

javax.swing.JTextField acctnam = new javax.swing.JTextField(15);

javax.swing.JComboBox type = new javax.swing.JComboBox();

type.addItem(“select”);

type.addItem(“savings”);

type.addItem(“current”);

javax.swing.JPanel myPanel = new javax.swing.JPanel();

myPanel.add(new JLabel(“Account Name”));

myPanel.add(acctnam);

myPanel.add(Box.createVerticalStrut(10)); // a spacer

myPanel.add(new JLabel(“Account Type”));

myPanel.add(type);

int result = JOptionPane.showConfirmDialog(null, myPanel,

“Create Account”, JOptionPane.OK_CANCEL_OPTION);

if (result == JOptionPane.OK_OPTION)

{

String Acct = acctnam.getText();

String deposit = type.getSelectedItem().toString();

int bal=0;

int acctnum =(int)((Math.random()*9000)+1000);

create_account(Acct,acctnum,bal,deposit);

JOptionPane1.showMessageDialog(this,”Account Created Succeffully \n Account Number : “+acctnum);

}

else

JOptionPane1.showMessageDialog(this,”Kindly enter Account Number and press OK”);

}

private void displayActionPerformed(java.awt.event.ActionEvent evt) {

javax.swing.JTextField acctnum = new javax.swing.JTextField(15);

javax.swing.JPanel myPanel = new javax.swing.JPanel();

myPanel.add(new JLabel(“Account Number”));

myPanel.add(acctnum);

myPanel.add(Box.createVerticalStrut(10)); // a spacer

int result = JOptionPane.showConfirmDialog(null, myPanel,

“Please Enter Account Number “, JOptionPane.OK_CANCEL_OPTION);

if (result == JOptionPane.OK_OPTION) {

int Acct = Integer.parseInt(acctnum.getText());

if(Acct== Acc_num)

{

JOptionPane1.showMessageDialog(this,” Account Name: “+ name+”\n Account Number”+Acc_num+”\nAccount Type”+acc_type+”\nAccount Balance =”+Acc_Balance );

}

else

JOptionPane1.showMessageDialog(this,”Account Number Not Valid”);

}

}

private void withdrawActionPerformed(java.awt.event.ActionEvent evt) {

javax.swing.JTextField acctnum = new javax.swing.JTextField(15);

javax.swing.JTextField amount = new javax.swing.JTextField(15);

javax.swing.JPanel myPanel = new javax.swing.JPanel();

myPanel.add(new JLabel(“Account Number”));

myPanel.add(acctnum);

myPanel.add(Box.createVerticalStrut(10)); // a spacer

myPanel.add(new JLabel(“Amount To Withdraw”));

myPanel.add(amount);

int result = JOptionPane.showConfirmDialog(null, myPanel,

“Enter Acct and the Amount to withdraw”, JOptionPane.OK_CANCEL_OPTION);

if (result == JOptionPane.OK_OPTION) {

int Acct = Integer.parseInt(acctnum.getText());

int deposits = Integer.parseInt(amount.getText());

if(Acct== Acc_num)

{

if(deposits<Acc_Balance)

{

Acc_Balance = Acc_Balance – deposits;

JOptionPane1.showMessageDialog(this,””+ deposits+ ” Has been withdrawn \n Balance =”+Acc_Balance );

}

else

JOptionPane1.showMessageDialog(this, ”Amount to be withdrawn must be less than Available \n Your Available is:”+Acc_Balance);

}

else

JOptionPane1.showMessageDialog(this,”Account Number Not Valid”);

}

else

JOptionPane1.showMessageDialog(this,”Kindly enter Account Number and press OK”);

}

private void checkActionPerformed(java.awt.event.ActionEvent evt) {

javax.swing.JTextField acctnum = new javax.swing.JTextField(15);

javax.swing.JPanel myPanel = new javax.swing.JPanel();

myPanel.add(new JLabel(“Account Number”));

myPanel.add(acctnum);

myPanel.add(Box.createVerticalStrut(10)); // a spacer

int result = JOptionPane.showConfirmDialog(null, myPanel,

“Please Enter Account Number “, JOptionPane.OK_CANCEL_OPTION);

if (result == JOptionPane.OK_OPTION) {

int Acct = Integer.parseInt(acctnum.getText());

if(Acct==this.Acc_num)

{

JOptionPane1.showMessageDialog(this,”Account Balance is:”+Acc_Balance);

}

else

JOptionPane1.showMessageDialog(this,”Kindly enter Account Number and press OK”);

}

}

private void ApplyActionPerformed(java.awt.event.ActionEvent evt) {

loans l = new loans(Acc_num,Acc_Balance);

l.setVisible(true);

}

private void openActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

fixdepo d = new fixdepo();

d.setVisible(true);

}

public static void main(String args[]) {

try {

for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())

{

if (“Nimbus”.equals(info.getName()))

{

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

}

}

}

catch (ClassNotFoundException ex)

{

java.util.logging.Logger.getLogger(home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

}

catch (InstantiationException ex)

{

java.util.logging.Logger.getLogger(home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

}

catch (IllegalAccessException ex)

{

java.util.logging.Logger.getLogger(home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

}

catch (javax.swing.UnsupportedLookAndFeelException ex)

{

java.util.logging.Logger.getLogger(home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

}

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable()

{

public void run()

{

home h = new home();

h.setVisible(true);

}

});

}

// Variables declaration – do not modify

private javax.swing.JButton Apply;

private javax.swing.JButton check;

private javax.swing.JButton create;

private javax.swing.JButton deposit;

private javax.swing.JButton display;

private javax.swing.JLabel jLabel1;

private javax.swing.JButton open;

private javax.swing.JButton withdraw;

// End of variables declaration

}

//Applying for a loan program

public class loans extends javax.swing.JFrame {static int Acct_no;

static int Acct_Bal;

double interest,total,due;

public loans(int Acct, int Bal) {

initComponents();

Acct_no = Acct;

Acct_Bal = Bal;

}

@SuppressWarnings(“unchecked”)

// <editor-fold defaultstate=”collapsed” desc=”Generated Code”>

private void initComponents() {

jButton1 = new javax.swing.JButton();

acct = new javax.swing.JTextField();

amount = new javax.swing.JTextField();

type = new javax.swing.JComboBox();

jLabel1 = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setTitle(“Apply Loan”);

jButton1.setText(“Apply”);

jButton1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton1ActionPerformed(evt);

}

});

acct.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

acctActionPerformed(evt);

}

});

type.setModel(new javax.swing.DefaultComboBoxModel(new String[] { “Car”, “Education”, “House” }));

jLabel1.setText(“Account Number”);

jLabel2.setText(“Period”);

jLabel3.setText(“Loan Type”);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(158, 158, 158)

.addComponent(jButton1)

.addContainerGap(183, Short.MAX_VALUE))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()

.addGap(51, 51, 51)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jLabel1)

.addComponent(jLabel2)

.addComponent(jLabel3))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(type, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(amount)

.addComponent(acct))

.addGap(99, 99, 99))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()

.addGap(51, 51, 51)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(acct, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel1))

.addGap(18, 18, 18)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(amount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel2))

.addGap(26, 26, 26)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(type, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel3))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE)

.addComponent(jButton1)

.addGap(84, 84, 84))

);

pack();

}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)

{

// TODO add your handling code here:

int acc = Integer.parseInt(acct.getText());

int amounts =Integer.parseInt(amount.getText()) ;

String types = type.getSelectedItem().toString();

if(acc==Acct_no)

{

if(Acct_Bal>1000)

{

if(types==”Car”)

{

interest = amounts * (10.5/100);

}

else if(types==”House”)

{

interest = amounts * (8.5/100);

}

else if(types==”Education”)

{

interest = amounts * (5.5/100);

}

total = interest+amounts;

int dur =(int) total/12;

JOptionPane1.showMessageDialog(this,”Your loan has been granted Amount to pay\n Amount: “+total+” within 1 year\n “+dur+” Each Month”);

this.setVisible(false);

}

else

{

JOptionPane1.showMessageDialog(this,”You must have atleast Rs.1000 to Apply for loan\n “);

this.setVisible(false);

}

}

else

{

JOptionPane1.showMessageDialog(this,”Account Number Invalid\n Enter Valid Acct Num”);

}

}

private void acctActionPerformed(java.awt.event.ActionEvent evt)

{

// TODO add your handling code here:

}

public static void main(String args[])

{

//<editor-fold defaultstate=”collapsed” desc=” Look and feel setting code (optional) “>

try

{

for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

if (“Nimbus”.equals(info.getName()))

{

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

}

}

}

catch (ClassNotFoundException ex)

{

java.util.logging.Logger.getLogger(loans.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

}

catch (InstantiationException ex)

{

java.util.logging.Logger.getLogger(loans.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

}

catch (IllegalAccessException ex)

{

java.util.logging.Logger.getLogger(loans.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

}

catch (javax.swing.UnsupportedLookAndFeelException ex)

{

java.util.logging.Logger.getLogger(loans.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

}

java.awt.EventQueue.invokeLater(new Runnable()

{

public void run()

{

new loans(Acct_no, Acct_Bal).setVisible(true);

}

});

}

// Variables declaration – do not modify

private javax.swing.JTextField acct;

private javax.swing.JTextField amount;

private javax.swing.JButton jButton1;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JComboBox type;

// End of variables declaration

private javax.swing.JOptionPane JOptionPane1;

}

//Fixed Deposit Account program

public class fixdepo extends javax.swing.JFrame

{

public fixdepo()

{

initComponents();

}

@SuppressWarnings(“unchecked”)

// <editor-fold defaultstate=”collapsed” desc=”Generated Code”>

private void initComponents()

{

acc_name = new javax.swing.JTextField();

money = new javax.swing.JTextField();

durations = new javax.swing.JComboBox();

jLabel1 = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

create = new javax.swing.JButton();

jLabel4 = new javax.swing.JLabel();

period = new javax.swing.JComboBox();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

acc_name.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

acc_nameActionPerformed(evt);

}

});

durations.setModel(new javax.swing.DefaultComboBoxModel(new String[] { “yearly”, “monthly”, “quaterly ” }));

jLabel1.setText(“Account Name”);

jLabel2.setText(“Money to deposit”);

jLabel3.setText(“Duration”);

create.setText(“Create”);

create.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

createActionPerformed(evt);

}

});

jLabel4.setText(“Period”);

period.setModel(new javax.swing.DefaultComboBoxModel(new String[] { “1”, “2”, “3”, “4”, “5” }));

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jLabel1)

.addComponent(jLabel2)

.addComponent(jLabel3))

.addGap(60, 60, 60)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(layout.createSequentialGroup()

.addComponent(acc_name, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(97, 97, 97))

.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()

.addComponent(money, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(97, 97, 97))))

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(142, 142, 142)

.addComponent(create))

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addComponent(jLabel4)

.addGap(113, 113, 113)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(durations, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(period, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))))

.addGap(0, 0, Short.MAX_VALUE))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(63, 63, 63)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(acc_name, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel1))

.addGap(37, 37, 37)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(money, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel2))

.addGap(18, 18, 18)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel4)

.addComponent(period, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(27, 27, 27)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel3)

.addComponent(durations, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)

.addComponent(create)

.addGap(24, 24, 24))

);

pack();

}

private void acc_nameActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

}

private void createActionPerformed(java.awt.event.ActionEvent evt) {

String acc_names =acc_name.getText();

int moneys=Integer.parseInt(money.getText());

String duration = durations.getSelectedItem().toString();

int per = Integer.parseInt(period.getSelectedItem().toString());

int aNumber =(int)((Math.random()*9000)+1000);

double pere=0;

if(per==1)

pere= 0.08;

if(per==2)

pere=0.10;

if(per==3)

pere=0.15;

if(per>3)

pere=0.20;

double interest=0;

switch(duration)

{

case “yearly”:

interest= moneys * ((double)Math.pow((1 + (pere / 1)),(1 * per)));

break;

case “monthly”:

interest= moneys * ((double)Math.pow((12 + (pere / 12)),(12 * per)));

break;

case “quarterly”:

interest= moneys * ((double)Math.pow((4 + (pere / 4)),(4 * per)));

break;

default:

System.out.println(“”);

}

JOptionPane1.showMessageDialog(this,”Your Fixed Deposit Account Number:”+aNumber+ “\nInitial Deposit:”+moneys+” Earned money After”+per+”year is “+interest);

// TODO add your handling code here:

}

public static void main(String args[])

{

//<editor-fold defaultstate=”collapsed” desc=” Look and feel setting code (optional) “>

try {

for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

if (“Nimbus”.equals(info.getName()))

{

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

}

}

}

catch (ClassNotFoundException ex)

{

java.util.logging.Logger.getLogger(fixdepo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

}

catch (InstantiationException ex)

{

java.util.logging.Logger.getLogger(fixdepo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

}

catch (IllegalAccessException ex)

{

java.util.logging.Logger.getLogger(fixdepo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

}

catch (javax.swing.UnsupportedLookAndFeelException ex)

{

java.util.logging.Logger.getLogger(fixdepo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

}

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new fixdepo().setVisible(true);

}

});

}

// Variables declaration – do not modify

private javax.swing.JTextField acc_name;

private javax.swing.JButton create;

private javax.swing.JComboBox durations;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

private javax.swing.JTextField money;

private javax.swing.JComboBox period;

// End of variables declaration

private javax.swing.JOptionPane JOptionPane1;

}

Add a comment
Know the answer?
Add Answer to:
I need to make a GUI in java with swing, that is from a bank system...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Q.3\ How could IT/e-banking assist an organization/ a bank to achieve a competitive advantage in the...

    Q.3\ How could IT/e-banking assist an organization/ a bank to achieve a competitive advantage in the marketplace? Explain through the case of Citibank. please make sure you give a unique answer (not copied one) ,Please no hand writing, and need references. This question is from ECOM 421 e-Business Strategies and Business Models course e-Business Strategy and Models in Banks : Case of Citibank E-business strategy in Citibank: Banks today are up-to-date with both the pros and cons of the internet....

  • e-Business Strategy and Models in Banks : Case of Citibank E-business strategy in Citibank: Banks today...

    e-Business Strategy and Models in Banks : Case of Citibank E-business strategy in Citibank: Banks today are up-to-date with both the pros and cons of the internet. They are aware of the opportunities and threats that are associated with the Web. Not a single traditional bank is brave enough to face investment analysts without an Internet strategy. But even a very thoughtful approach to the Web may do no good to the company/ organization. The main purpose behind launching online...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT