Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,735 members, 7,817,022 topics. Date: Friday, 03 May 2024 at 11:17 PM

Title Program To Create GUI For Bank App - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Title Program To Create GUI For Bank App (1313 Views)

A Python Program To Check The Risk Of Corona Virus. / Program To Find The Hcf Of Two Numbers / What The Best C++ Program To Download ? (2) (3) (4)

(1) (Reply) (Go Down)

Title Program To Create GUI For Bank App by jimklef(m): 2:08pm On Jan 24, 2017
Hi guys, i just decide to share dis sweat java gui app source code,

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class GuiAccTest extends Frame implements ActionListener
{
Label lab=new Label(" "wink;
Label lab1=new Label(" "wink;
TextField t[]=new TextField [4];
Label l[]=new Label [4];
Button but=new Button("Create Account"wink;
Button but1=new Button("Test Account"wink;
BankAccount b;
GuiAccTest()
{
addWindowListener(new NewWindowAdapter());
setLayout(new GridLayout(2,0));
Panel p=new Panel();
Panel p1=new Panel();
but.addActionListener(this);
but1.addActionListener(this);
p.setLayout(new GridLayout(5,2));
p1.add(lab1);
p1.add(lab);
l[0]=new Label("Account Number"wink;
l[1]=new Label("Initial Balance"wink;
l[2]=new Label("Deposit Amount"wink;
l[3]=new Label("Withdraw Amount"wink;
for(int i=0;i<4;i++)
{
t[i]=new TextField(10);
p.add(l[i]);
p.add(t[i]);
}
p.add(but);
p.add(but1);
but1.setVisible(false);
l[2].setVisible(false);
l[3].setVisible(false);
t[2].setVisible(false);
t[3].setVisible(false);
add(p);
add(p1);
}
String testAccount(int d_amt,int w_amt)
{
String msg;
b.deposit(d_amt);
msg="Transaction Succesful";
try
{
b.withdraw(w_amt);
}catch(FundsInsufficientException fe)
{
fe=new FundsInsufficientException(b.amount,w_amt);
msg=String.valueOf(fe);
}
return msg;
}
public void actionPerformed(ActionEvent ae)
{
String str=ae.getActionCommand();
if(str.equals("Create Account"wink)
{
b=new BankAccount(Integer.parseInt(t[0].getText()),Integer.parseInt(t[1].getText()));
but1.setVisible(true);
l[2].setVisible(true);
l[3].setVisible(true);
t[2].setVisible(true);
t[3].setVisible(true);
but.setVisible(false);
l[0].setVisible(false);
l[1].setVisible(false);
t[0].setVisible(false);
t[1].setVisible(false);
lab1.setText("Account : "+b.accnum+", Current Balance : "+b.amount);
return;
}
else
{
lab.setText(testAccount(Integer.parseInt(t[2].getText()),Integer.parseInt(t[3].getText())));
lab1.setText("Account : "+b.accnum+", Current Balance : "+b.amount);
}
}
public static void main(String arg[])
{
GuiAccTest at=new GuiAccTest();
at.setTitle("Bank Account Tester"wink;
at.setSize(600,200);
at.setVisible(true);
}
}
class NewWindowAdapter extends WindowAdapter
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
}
class BankAccount
{
int accnum;
int amount;
BankAccount(int num,int amt)
{
accnum=num;
amount=amt;
}
public void deposit(int amt)
{
amount=amount+amt;
}
public void withdraw(int amt) throws FundsInsufficientException
{
if(amt>amount)
throw new FundsInsufficientException(amount,amt);
else
amount=amount-amt;
}
}
class FundsInsufficientException extends Exception
{
int balance;
int withdraw_amount;
FundsInsufficientException(int bal,int w_amt)
{
balance=bal;
withdraw_amount=w_amt;
}
public String toString()
{
return "Your withdraw amount ("+withdraw_amount+"wink is less than the balance ("+balance+"wink. No withdrawa
visit here 4 mre source code www./1idNQa or www.vyomworld.com , make sure you debug it, bcus of any error, thnk u.
Re: Title Program To Create GUI For Bank App by Nobody: 2:31pm On Jan 24, 2017
this your code is as long as Lagos-Ibadan express-way, but you try sha, kudos.
Re: Title Program To Create GUI For Bank App by raymod170(m): 3:16pm On Jan 24, 2017
it would have been better if we saw the gui your code created rather than the code itself

1 Like

Re: Title Program To Create GUI For Bank App by Nobody: 3:28pm On Jan 24, 2017
And it will be better if the code is on github for better reference, or bitcuket or even pastebin. Nairaland spambot don dabaru am.
Am sure the spambot must be an Afonjalistic something sef from the way it behaves.

2 Likes

Re: Title Program To Create GUI For Bank App by raymod170(m): 4:23pm On Jan 24, 2017
true talk really codes should be placed on gitbub rather than here it makes it mpre valued by fellow programmers really
Re: Title Program To Create GUI For Bank App by jimklef(m): 4:34pm On Jan 24, 2017
raymod170:
true talk really codes should be placed on gitbub rather than here it makes it mpre valued by fellow programmers really
thank i will do that
Re: Title Program To Create GUI For Bank App by teemy(m): 11:08am On Jan 26, 2017
dhtml18:
And it will be better if the code is on github for better reference, or bitcuket or even pastebin. Nairaland spambot don dabaru am.
Am sure the spambot must be an Afonjalistic something sef from the way it behaves.
Isn't the site owner? Sorry for the spambot going gaga but I doubt it has to do with ethnicity of its code grin
Re: Title Program To Create GUI For Bank App by Nobody: 12:56pm On Jan 26, 2017
teemy:

Isn't the site owner? Sorry for the spambot going gaga but I doubt it has to do with ethnicity of its code grin
At least we are agreed on the fact that the spambot exhibits some form of madness sometimes, well, maybe it is not due to its ethnicity sha, but you never can tell sha.

1 Like

(1) (Reply)

Freelance Web Developers And Software Engineers Urgently Needed / If You Want To Hire C# ASP.NET Core Developers With The Following Skills / Upwork Identify Verification

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 20
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.