December 1, 2009 at 10:42 AM
Hi Friend,
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JOptionPane;
import javax.swing.JButton;
class CurrentAccount extends JFrame
{
private JLabel label1;
private JLabel label2;
private JLabel label3;
private JTextField textField1;
private JTextField textField2;
private JTextField textField3;
private JTextField textField4;
private JTextField textField5;
private JTextField textField6;
private JTextField textField7;
private JTextField textField8;
private JTextField textField9;
private JTextField textField10;
private JTextField textField11;
private JTextField textField12;
private JTextField textField13;
private JTextField textField14;
private JTextField textField15;
private JTextField textField16;
private JTextField textField17;
private JTextField textField18;
private JTextField textField19;
private JPasswordField passwordField;
private JButton plainJButton;
private JButton resetJButton;
public CurrentAccount(){
super( "Current Account" );
setLayout( new FlowLayout() );
{
setLayout( new FlowLayout() );
label1 = new JLabel( "With Your Banking Solutions" );
label1.setToolTipText( "This is label1" );
add( label1 );
Icon bug = new ImageIcon( getClass().getResource( "current.gif" ) );
label3 = new JLabel();
label3.setText( "Fill in the spaces below to create a Current Account !" );
label3.setIcon( bug );
label3.setHorizontalTextPosition( SwingConstants.CENTER );
label3.setVerticalTextPosition( SwingConstants.BOTTOM );
label3.setToolTipText( "This is label3" );
add( label3 ); }
textField2 = new JTextField( "First Name:",15 );
textField2.setEditable( false );
add( textField2 );
textField1 = new JTextField( 15 );
add( textField1 );
textField4 = new JTextField( "Second Name:",15 );
textField4.setEditable( false );
add( textField4 );
textField5 = new JTextField( 15 );
add( textField5 );
textField6 = new JTextField( "University:",15 );
textField6.setEditable( false );
add( textField6 );
textField7 = new JTextField( 15 );
add( textField7 );
textField8 = new JTextField( "Faculty:",15 );
textField8.setEditable( false );
add( textField8 );
textField9 = new JTextField( 15 );
add( textField9 );
textField10 = new JTextField( "Course:",15 );
textField10.setEditable( false );
add( textField10 );
textField11 = new JTextField( 15 );
add( textField11 );
textField12 = new JTextField( "Year Of Study:",15 );
textField12.setEditable( false );
add( textField12 );
textField13 = new JTextField( 15 );
add( textField13 );
textField14 = new JTextField( "Tel NO:",15 );
textField14.setEditable( false );
add( textField14 );
textField15 = new JTextField( 15 );
add( textField15 );
textField16 = new JTextField( "Email:",15 );
textField16.setEditable( false );
add( textField16 );
textField17 = new JTextField( 15 );
December 1, 2009 at 10:46 AM
continue...
add( textField17 );
textField18 = new JTextField( "Physical Address:",15 );
textField18.setEditable( false );
add( textField18 );
textField19 = new JTextField( 15 );
add( textField19 );
textField3 = new JTextField( "Username",15 );
textField3.setEditable( false );
add( textField3 );
passwordField = new JPasswordField( "",15 );
add( passwordField );
plainJButton = new JButton( "Submit" );
add( plainJButton );
resetJButton = new JButton( "Reset" );
add( resetJButton );
plainJButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
Template temp=new Template();
temp.setVisible(true);
}
});
TextFieldHandler handler = new TextFieldHandler();
textField1.addActionListener( handler );
textField2.addActionListener( handler );
textField3.addActionListener( handler );
textField4.addActionListener( handler );
textField5.addActionListener( handler );
passwordField.addActionListener( handler );
}
private class TextFieldHandler implements ActionListener{
public void actionPerformed( ActionEvent event ){
String string = "";
if ( event.getSource() == textField1 )
string = String.format( "textField1: %s",
event.getActionCommand() );
else if ( event.getSource() == textField2 )
string = String.format( "textField2: %s",
event.getActionCommand() );
else if ( event.getSource() == textField3 )
string = String.format( "textField3: %s",
event.getActionCommand() );
else if ( event.getSource() == textField4 )
string = String.format( "textField4: %s",
event.getActionCommand() );
else if ( event.getSource() == textField5 )
string = String.format( "textField5: %s",
event.getActionCommand() );
else if ( event.getSource() == textField6 )
string = String.format( "textField6: %s",
event.getActionCommand() );
else if ( event.getSource() == textField7 )
string = String.format( "textField7: %s",
event.getActionCommand() );
else if ( event.getSource() == textField8 )
string = String.format( "textField8: %s",
event.getActionCommand() );
else if ( event.getSource() == textField9 )
string = String.format( "textField9: %s",
event.getActionCommand() );
else if ( event.getSource() == textField10 )
string = String.format( "textField10: %s",
event.getActionCommand() );
else if ( event.getSource() == textField11 )
string = String.format( "textField11: %s",
event.getActionCommand() );
else if ( event.getSource() == textField12 )
string = String.format( "textField12: %s",
event.getActionCommand() );
else if ( event.getSource() == textField13 )
string = String.format( "textField13: %s",
event.getActionCommand() );
else if ( event.getSource() == textField14 )
string = String.format( "textField14: %s",
event.getActionCommand() );
else if ( event.getSource() == textField15 )
string = String.format( "textField15: %s",
event.getActionCommand() );
else if ( event.getSource() == textField16 )
string = String.format( "textField16: %s",
event.getActionCommand() );
else if ( event.getSource() == textField17 )
string = String.format( "textField17: %s",
event.getActionCommand() );
else if ( event.getSource() == textField18 )
string = String.format( "textField18: %s",
event.getActionCommand() );
else if ( event.getSource() == textField19 )
string = String.format( "textField19: %s",
event.getActionCommand() );
else if ( event.getSource() == passwordField )
string = String.format( "passwordField: %s",
new String( passwordField.getPassword() ) );
}
}
}
December 1, 2009 at 10:48 AM
continue..
public class FinalAccount{
public static void main( String args[] ){
CurrentAccount textFieldFrame = new CurrentAccount();
textFieldFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
textFieldFrame.setSize( 400, 410 );
textFieldFrame.setVisible( true );
}
}
Template.java
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JOptionPane;
import javax.swing.JButton;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Template extends JFrame{
private JLabel label1;
private JLabel label2;
private JLabel label3;
private JTextField textField1;
private JTextField textField2;
private JTextField textField3;
private JTextField textField4;
private JPasswordField passwordField;
private JButton plainJButton;
private JButton fancyJButton;
public Template(){ super("Walz Bank International");
setLayout( new FlowLayout() );{
label1 = new JLabel( "With Your Banking Solutions" );
label1.setToolTipText( "This is label1" );
add( label1 );
Icon bug = new ImageIcon( getClass().getResource( "a.gif" ) );
label3 = new JLabel();
label3.setText( "Login If registered Customer" );
label3.setIcon( bug );
label3.setHorizontalTextPosition( SwingConstants.CENTER );
label3.setVerticalTextPosition( SwingConstants.BOTTOM );
label3.setToolTipText( "This is label3" );
add( label3 );
}
textField2 = new JTextField( "Username" );
textField2.setEditable(false);
add( textField2 );
textField1 = new JTextField( 15 );
add( textField1 );
textField3 = new JTextField( "PIN Code");
textField3.setEditable( false );
add( textField3 );
passwordField = new JPasswordField( "",15 );
add( passwordField );
plainJButton = new JButton( "Enter" );
add( plainJButton );
textField4 = new JTextField( "Create an Account",21 );
textField4.setEditable(false);
add( textField4 );
plainJButton = new JButton( "Savings Acc" );
add( plainJButton );
plainJButton = new JButton( "Current Acc" );
add( plainJButton );
TextFieldHandler handler = new TextFieldHandler();
textField1.addActionListener( handler );
textField2.addActionListener( handler );
textField3.addActionListener( handler );
textField4.addActionListener( handler);
passwordField.addActionListener( handler );
pack();
}
private class TextFieldHandler implements ActionListener{
public void actionPerformed( ActionEvent event ){
String string = "";
if ( event.getSource() == textField1 )
string = String.format( "textField1: %s",
event.getActionCommand() );
else if ( event.getSource() == textField2 )
string = String.format( "textField2: %s",
event.getActionCommand() );
else if ( event.getSource() == textField3 )
string = String.format( "textField3: %s",
event.getActionCommand() );
else if ( event.getSource() == passwordField )
string = String.format( "passwordField: %s",
new String( passwordField.getPassword() ) );
JOptionPane.showMessageDialog( null, string );
}
}
}
Thanks
Related Tutorials/Questions & Answers:
javajava diff bt core
java and
java Advertisements
java java why iterator in
java if we for loop
Java Java Whether
Java is pure object oriented Language
JAVAJAVA how the name came for
java language as "
JAVA javajava explain technologies are used in
java now days and structure
java javajava different between
java & core
java javajava is
java open source
javajava what is
java reflection
java java in
java does not pointers concept but what is nullpointers in
java?
nullpointer is a runtime Exception
javawhat is the size of array in
java ? what is the size of array in
java ?
what is the mean of finalize in
java javajava why to set classpath in
java javajava RARP implementation using
java socket
javajava sample code for RARP using
java JavaJava how to do
java in command prompt
javajava how use
java method
javajava is
java purely object oriented language
javajava why multiple inheritance is not possible in
java javajava give a simple example for inheritance in
java javajava give a simple example for inheritance in
java javajava why to set classpath in
java javajava why to set classpath in
java javajava why to set classpath in
java java java What is ?static? keyword
javajava Does
java allows multiline comments
javajava Write a
java code to print "ABABBABCABABBA
javajava write a program in
java to acess the email
javajava send me
java interview questions
javajava what are
JAVA applications development tools
JavaJava Whether
Java is Programming Language or it is SOftware
javajava explain object oriented concept in
java java java difference between class and interface
JavaJava how to draw class diagrams in
java javajava write a
java program using filenotfoundexception
javajava how to edit text document by using
java
then how to edit starting and ending of text document by using
java javajava different between
java & core
java
print("code sample
java java how can use sleep in
java
which book learn of
java language
java java How to set
java Policy for applet using jdk 6
javajava pattern code for a given words
java pattern code for a given words pattern
javajava dear,
i want a field for date picker using
java/
java script
javajava create
java program for delete and update the details,without using database, just a normal
java program
javajava why methods in
java raise exceptions
Have a look at the following link:
Java Exceptions
javajava code to search the nodes how to write the
java code to search the nodes using routers
javajava online telephone directory i need coding for online telephone directory..by using
java....pls help me
javajava different between
java & core
java
print("code sample
javajava how to invoke one chart
java file from another
java file
javajava how to prepare the
java
Hi Friend,
If you want to learn how to install
java, creating and running a
java program then go through the following links:
http://www.roseindia.net/
java/beginners/index.shtml
http
javajava
java swing
Swing is a principal GUI toolkit for the
Java programming language. It is a part of the JFC (
Java Foundation Classes), which is an API for providing a graphical user interface for
Java programs
javajava what is the need of
java if
java is not there what will happen... work unless you have
Java installed, and more are created every day.
Java... to scientific supercomputers, cell phones to the Internet,
Java is everywhere!
http