Menu Bar

Horizontal Scrollable Menu

ads

Search This Blog

How to create banking project page-4 in java Gui application | Source code


https://www.myprogrammingschool.com/search/label/Project
This page is the fourth part of  the banking project .Here we have to create frame and then we can see there there are different types of Button is  created on frame .
1) WITHDRAWAL Button
2) DEPOSIT Button 
3) TRANSFER Button 
4) CHANGER-PASSWORD Button
5) CANCEL Button
In this all Button we kept image to make attractive

Source code:

// header file
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;

public class Banking4 extends JPanel implements ActionListener
{
JFrame f4; 
JLabel  l1;
JButton b1,b2,b3,b4,b5;
JTextField t1;
Banking4()
{
f4=new JFrame("Signin Page");
l1=new JLabel("Your Total amount,Rs:-");

// we are creating icon of image to keep on the place of button
ImageIcon bg1=new ImageIcon("withdraw.png");
ImageIcon bg2=new ImageIcon("deposit.png");
ImageIcon bg3=new ImageIcon("TRANSFER.png");
ImageIcon bg4=new ImageIcon("changepassword.png");
ImageIcon bg5=new ImageIcon("cancel.png");

// we creating button where we passed image object.
b1=new JButton(bg1);
b2=new  JButton(bg2);
b3=new JButton(bg3);
b4=new JButton(bg4);
b5=new JButton(bg5);

// how our frame will look like
f4.setVisible(true);
f4.setSize(1100,1100);
f4.setLayout(null);
f4.setBackground(Color.BLUE);

// declaring place where the object will located on frame
l1.setBounds(200,10,500,100);
b1.setBounds(50,250,400,100);
b2.setBounds(550,250,400,100);
b3.setBounds(50,400,400,100);
b4.setBounds(550,390,600,190);
b5.setBounds(300,590,400,100);

// adding object on frame
f4.add(l1);
f4.add(b1);
f4.add(b2);
f4.add(b3);
f4.add(b4);
f4.add(b5);

// when we click button some action will 
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);

}
 public void actionPerformed(ActionEvent aa)
{
if(aa.getSource().equals(b1))
{

// here you can pass what action should be performed on button(b1)

}
if(aa.getSource().equals(b2));
{

// here you can pass what action should be performed on button(b2)

}

if(aa.getSource().equals(b3))
{
// here you can pass what action should be performed on button(b3)

}
if(aa.getSource().equals(b4));
{
// here you can pass what action should be performed on button(b4)
}

if(aa.getSource().equals(b5));
{
// here you can pass what action should be performed on button(b5)

f4.setVisible(false);
new Banking();
}
}

public static void main(String ss[])
{
 new Banking4();
}
}

No comments:

ads3