Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


gaetano
java
3 Answer(s)      4 years and 9 months ago
Posted in : Swing AWT



Advertisement
View Answers

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:
java
java   What is ?static? keyword
java
java  hi im new to java plz suggest me how to master java....saifjunaid@gmail.com
Advertisements
java
java  1.what type of inheritance supported in java. 2.what is the advantage of java over C++.   Hi Friend, Java supports following... inheritance Advantages of Java over C++: 1)Java is pure object oriented
Java
Java   What is the immediate superclass of the Dialog class
java
java  i need to draw a binary tree traversal in java applet
java
of java connection to the database to the java program   Hello Friend, Please visit the following link: Java Database Connectivity Here you will find several examples related to java database connectivity. Thanks
java
java  why we pass reference as a parameter in any java method
java
java  how to learn d java in easy way   Hi Friend, Please visit the following link: Java Tutorials Thanks
java
java  please any one give me idea for how to learn applet in java and then any one tell me concept for applet in java
JAVA
JAVA  Name Explanation about Java....   Hi Friend, Please clarify your problem. Thanks   Abbreviation of JAVA
JAVA
JAVA  If anybody know the abbreviation of JAVA....   JAVA is a full functioning programming structure by Sun Microsystems there is no abbreviation, and it is not the abbreviation (or acronym) of anything
java
, visit the following links: http://www.roseindia.net/java/master-java/java-left-shift.shtml http://www.roseindia.net/java/master-java/java-right-shift.shtml
java
java  can we implement two main class in java?   Hi Friend, A java class should have only one main method. Thanks
Java
Java  How to install java on linux ubuntu?   Hi Friend, Please visit the following links: http://www.roseindia.net/linux/linux-java-install.shtml http://www.roseindia.net/linux/tutorial/installingjdk5onlinux.shtml
java
java  write a programe in java such as child thread excutes 3 times more than main thread
JAva
JAva   how to make a class final without using final keyword
java
java  write a programe in java such as child thread excutes 3 times more than main thread
java
java  where i write java programme and how do i execute the programme
java
java  hi all i have a problem ,i want to sotre form data in table with foreign key in java ,please help me  Hi,Are you developing desktop or JSP application?Thanks
java
java  What is the purpose of Void class?  The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the Java keyword void
java
java  I need to draw a Binary tree using Inorder traversal algorithm.. in java applets using rectangles and ellipse objects.. can anyone help me about
java
inheritance. Java does not support multiple inheritance but the multiple inheritance...://www.roseindia.net/java/language/inheritance.shtml
java
java  Hi friends and how are you? i have a problem i need to write a java program which has a two java packages, one has the interface and the other has classes, with each class calculating the conversion of the South african
java
java  Pls help me with project or pls give me guide lines to this: Hi friends and how are you? i have a problem i need to write a java program which has a two java packages, one has the interface and the other has classes
java
java  What is DriverManager?  The JDBC Driver Manager is a very important class that defines objects which connect Java applications to a JDBC driver. Usually Driver Manager is the backbone of the JDBC architecture
java
java  <p>java program to find short form of namefor eg . sudhir kumar tiwari output should be s.k tiwari</p>  Hi Friend, import java.util.*; public class InitialName { public static void main
Java
Java  Hi I need help to edit values in database into jsp page textboxes, This is my code: editdata.jsp <%@ page language="java" import="java.util.*;"%> <%@ page language="java" import="java.sql.*"%> <
Java Fundamentals - Java Beginners
Java Fundamentals  What is the difference between Java Bean and Java Class
java - Java Interview Questions
Java Programming  What is Java Programming language
java
/TR/html4/loose.dtd"> <%@ page language="java" import="java.sql.*"%> <title>
Java - Java Interview Questions
Java  Questions on Java
java+cts - Java Beginners
java+cts  4100156952
Java Gui - Java Beginners
Java Gui  HOW TO ADD LINK LABELS IN JAVA PROGRAMMES
Java GUI - Java Beginners
Java GUI  HOW TO ADD ICONS IN JAVA GUI PROGRAMMES
JAva Projects - Java Magazine
JAva Projects  I need Some Java Projects
Java - Java Beginners
Java   HOW TO MAKE 3D GAMES IN JAVA
java - Java Beginners
Java GUI Builder software  Java GUI Builder software
core java - Java Beginners
core java  i want to get java projects in core java
java threads - Java Beginners
java threads  What is Thread in Java and why it is used
java - Java Magazine
Java string array declaration  How to declare a string array in Java
Java - Java Beginners
Java enum class tostring  An example of Java enum class tostring
java on linux - Java Beginners
java on linux  How to compile and execute java applications in linux
Java Questions - Java Beginners
Java Questions  Can we make 3d games in java
Java tools - Java Beginners
Java tools  how can we create a tool using java
java - Java Interview Questions
java  how to learn java
java - Java Beginners
Java virtual machine  What is java virtual machine?  Hello,Please check http://www.roseindia.net/help/java/f/java-foreach.shtmlThanks
java - Java Beginners
java  what are the logics of java
java - Java Beginners
Java keywords with examples  Java keywords with example to learn Java programming fast
java - Java Beginners
Java coding standards for developors  What is the java coding standards for Java application developers
java - Java Beginners
Core Java training  Is core java training is enough for Java application development
Advertisements
 

 

 

DMCA.com