AIM:
To implement the User Interface Layer defined for the Credit Card Processing system.
PROCEDURE:
1. Select projectname (e.g javaconference)→Rightclick on the project name→
new →other→Java→ Visual class.
2. Give Next →Give Name(eg UILayer) → select style →swing → Frame → enable public static void main as shown below → finish.
3. The UI layers .java tab will be opened with the JF Frame . 4. Right click on the JF Frame select as set layout → Null.
5. From the created JFrame select the palette which is present in the side of the JFrame. From that palette you can draw Menu Bar, Menus, Menu Item,
Buttons, etc…
6. Change to open perspective (java) → go run button →run as → java application.
1.LOGIN
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import java.awt.Rectangle;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JButton;
public class uil extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel Email_ID = null;
private JTextField jTextField = null;
private JLabel jLabel = null;
private JPasswordField jPasswordField = null;
private JButton jButton = null;
/**
* This method initializes jTextField *
* @return javax.swing.JTextField */
private JTextField getJTextField() { if (jTextField == null) {
jTextField = new JTextField();
jTextField.setBounds(new Rectangle(98, 27, 132, 20));
jTextField.setText("[email protected]");
}
return jTextField;
}
/**
* This method initializes jPasswordField *
* @return javax.swing.JPasswordField */
private JPasswordField getJPasswordField() { if (jPasswordField == null) {
jPasswordField = new JPasswordField();
jPasswordField.setBounds(new Rectangle(94, 58, 136, 20));
jPasswordField.setText("creditcard");
}
return jPasswordField;
} /**
* This method initializes jButton *
* @return javax.swing.JButton */
private JButton getJButton() { if (jButton == null) {
jButton = new JButton();
jButton.setBounds(new Rectangle(82, 111, 96, 25));
jButton.setText("Login");
}
return jButton;
}
/**
* @param args */
public static void main(String[] args) { // TODO Auto-generated method stub
SwingUtilities.invokeLater(new Runnable() {
public void run() {
uil thisClass = new uil();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
* This is the default constructor */
* This method initializes this *
* @return void */
private void initialize() { this.setSize(300, 200);
this.setContentPane(getJContentPane());
this.setTitle("Login");
}
/**
* This method initializes jContentPane *
* @return javax.swing.JPanel */
private JPanel getJContentPane() {
if (jContentPane == null) { jLabel = new JLabel();
jLabel.setBounds(new Rectangle(22, 62, 65, 16));
jLabel.setText("Password");
Email_ID = new JLabel();
Email_ID.setBounds(new Rectangle(20, 28, 66, 16));
Email_ID.setText("Email_ID");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(Email_ID, null);
jContentPane.add(getJTextField(), null);
jContentPane.add(jLabel, null);
jContentPane.add(getJPasswordField(), null);
jContentPane.add(getJButton(), null);
}
return jContentPane;
}
} // @jve:decl-index=0:visual-constraint="48,41"
2.REGISTER
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import java.awt.Dimension;
import javax.swing.JButton;
public class uil2 extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel jLabel = null;
private JTextField jTextField = null;
private JLabel jLabel1 = null;
private JTextField jTextField1 = null;
private JLabel jLabel2 = null;
private JPasswordField jPasswordField = null;
private JPasswordField jPasswordField1 = null;
private JLabel jLabel3 = null;
private JButton jButton = null;
private JButton jButton1 = null;
/**
* This method initializes jTextField *
* @return javax.swing.JTextField */
private JTextField getJTextField() { if (jTextField == null) {
jTextField = new JTextField();
jTextField.setBounds(new Rectangle(109, 33, 109, 20));
jTextField.setText("Siddharth");
}
return jTextField;
}
/**
* This method initializes jTextField1 *
* @return javax.swing.JTextField */
private JTextField getJTextField1() { if (jTextField1 == null) {
jTextField1 = new JTextField();
jTextField1.setBounds(new Rectangle(109, 67, 148, 20));
jTextField1.setText("[email protected]");
}
return jTextField1;
}
/**
* This method initializes jPasswordField *
* @return javax.swing.JPasswordField */
private JPasswordField getJPasswordField() { if (jPasswordField == null) {
jPasswordField = new JPasswordField();
jPasswordField.setBounds(new Rectangle(109, 96, 88, 20));
jPasswordField.setText("creditcard");
}
return jPasswordField;
} /**
* This method initializes jPasswordField1 *
* @return javax.swing.JPasswordField */
private JPasswordField getJPasswordField1() { if (jPasswordField1 == null) {
jPasswordField1 = new JPasswordField();
jPasswordField1.setBounds(new Rectangle(111, 128, 86, 20));
jPasswordField1.setText("creditcard");
}
return jPasswordField1;
} /**
* This method initializes jButton *
* @return javax.swing.JButton */
private JButton getJButton() { if (jButton == null) {
jButton = new JButton();
jButton.setBounds(new Rectangle(32, 172, 75, 18));
jButton.setText("submit");
}
return jButton;
} /**
* This method initializes jButton1 *
* @return javax.swing.JButton */
private JButton getJButton1() { if (jButton1 == null) {
jButton1 = new JButton();
jButton1.setBounds(new Rectangle(131, 172, 68, 18));
jButton1.setText("reset");
}
return jButton1;
} /**
* @param args */
public static void main(String[] args) { // TODO Auto-generated method stub
SwingUtilities.invokeLater(new Runnable() { public void run() {
uil2 thisClass = new uil2();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
* This is the default constructor */
* This method initializes this *
* @return void */
private void initialize() { this.setSize(300, 249);
this.setContentPane(getJContentPane());
this.setTitle("JFrame");
} /**
* This method initializes jContentPane *
* @return javax.swing.JPanel */
private JPanel getJContentPane() { if (jContentPane == null) {
jLabel3 = new JLabel();
jLabel3.setBounds(new Rectangle(29, 129, 72, 16));
jLabel3.setText("confirm pwd");
jLabel2 = new JLabel();
jLabel2.setBounds(new Rectangle(30, 98, 62, 16));
jLabel2.setText("Pwd");
jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(30, 66, 63, 16));
jLabel1.setText("Email_ID");
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(32, 33, 62, 16));
jLabel.setText("Name");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(jLabel, null);
jContentPane.add(getJTextField(), null);
jContentPane.add(jLabel1, null);
jContentPane.add(getJTextField1(), null);
jContentPane.add(jLabel2, null);
jContentPane.add(getJPasswordField(), null);
jContentPane.add(getJPasswordField1(), null);
jContentPane.add(jLabel3, null);
jContentPane.add(getJButton(), null);
jContentPane.add(getJButton1(), null);
}
return jContentPane;
}
} // @jve:decl-index=0:visual-constraint="10,10"
3.PURCHASE
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.JRadioButton;
import java.awt.Dimension;
import javax.swing.JButton;
public class juj extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
private JLabel jLabel2 = null;
private JRadioButton jRadioButton = null;
private JRadioButton jRadioButton1 = null;
private JRadioButton jRadioButton2 = null;
private JRadioButton jRadioButton3 = null;
private JRadioButton jRadioButton4 = null;
private JRadioButton jRadioButton5 = null;
private JButton jButton = null;
/**
* This method initializes jRadioButton *
* @return javax.swing.JRadioButton */
private JRadioButton getJRadioButton() { if (jRadioButton == null) {
jRadioButton = new JRadioButton();
jRadioButton.setBounds(new Rectangle(13, 75, 115, 21));
jRadioButton.setText("Samsung");
}
return jRadioButton;
} /**
* This method initializes jRadioButton1 *
* @return javax.swing.JRadioButton */
private JRadioButton getJRadioButton1() { if (jRadioButton1 == null) {
jRadioButton1 = new JRadioButton();
jRadioButton1.setBounds(new Rectangle(187, 72, 88, 21));
jRadioButton1.setText("Nokia");
}
return jRadioButton1;
} /**
* This method initializes jRadioButton2 *
* @return javax.swing.JRadioButton */
private JRadioButton getJRadioButton2() { if (jRadioButton2 == null) {
jRadioButton2 = new JRadioButton();
jRadioButton2.setBounds(new Rectangle(12, 110, 54, 21));
jRadioButton2.setText("Sony");
}
return jRadioButton2;
} /**
* This method initializes jRadioButton3 *
* @return javax.swing.JRadioButton
*/
private JRadioButton getJRadioButton3() { if (jRadioButton3 == null) {
jRadioButton3 = new JRadioButton();
jRadioButton3.setBounds(new Rectangle(12, 94, 71, 21));
jRadioButton3.setText("LG");
}
return jRadioButton3;
} /**
* This method initializes jRadioButton4 *
* @return javax.swing.JRadioButton */
private JRadioButton getJRadioButton4() { if (jRadioButton4 == null) {
jRadioButton4 = new JRadioButton();
jRadioButton4.setBounds(new Rectangle(186, 93, 82, 21));
jRadioButton4.setText("Ericsson");
}
return jRadioButton4;
} /**
* This method initializes jRadioButton5 *
* @return javax.swing.JRadioButton */
private JRadioButton getJRadioButton5() { if (jRadioButton5 == null) {
jRadioButton5 = new JRadioButton();
jRadioButton5.setBounds(new Rectangle(184, 111, 88, 21));
jRadioButton5.setText("Motorola");
}
return jRadioButton5;
} /**
* This method initializes jButton *
* @return javax.swing.JButton */
private JButton getJButton() { if (jButton == null) {
jButton = new JButton();
jButton.setBounds(new Rectangle(90, 140, 94, 17));
jButton.setText("Purchase");
}
return jButton;
} /**
* @param args */
public static void main(String[] args) { // TODO Auto-generated method stub
SwingUtilities.invokeLater(new Runnable() { public void run() {
juj thisClass = new juj();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
* This is the default constructor */
public juj() { super();
initialize();
}
/**
* This method initializes this *
* @return void */
private void initialize() { this.setSize(300, 200);
this.setContentPane(getJContentPane());
this.setTitle("Purchase");
} /**
* This method initializes jContentPane *
* @return javax.swing.JPanel */
private JPanel getJContentPane() { if (jContentPane == null) {
jLabel2 = new JLabel();
jLabel2.setBounds(new Rectangle(204, 47, 38, 16));
jLabel2.setText("Mobile");
jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(36, 48, 38, 16));
jLabel1.setText("Tv");
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(69, 19, 164, 16));
jLabel.setText("Select the product");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(jLabel, null);
jContentPane.add(jLabel1, null);
jContentPane.add(jLabel2, null);
jContentPane.add(getJRadioButton(), null);
jContentPane.add(getJRadioButton1(), null);
jContentPane.add(getJRadioButton2(), null);
jContentPane.add(getJRadioButton3(), null);
jContentPane.add(getJRadioButton4(), null);
jContentPane.add(getJRadioButton5(), null);
jContentPane.add(getJButton(), null);
}
return jContentPane;
}
} // @jve:decl-index=0:visual-constraint="160,72"
4.PAYMENT
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JButton;
import java.awt.Dimension;
public class amm extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel jLabel = null;
private JTextField jTextField = null;
private JLabel jLabel1 = null;
private JPasswordField jPasswordField = null;
private JLabel jLabel2 = null;
private JPasswordField jPasswordField1 = null;
private JButton jButton = null;
/**
* This method initializes jTextField *
* @return javax.swing.JTextField */
private JTextField getJTextField() { if (jTextField == null) {
jTextField = new JTextField();
jTextField.setBounds(new Rectangle(154, 32, 107, 20));
jTextField.setText("01007064");
}
return jTextField;
} /**
* This method initializes jPasswordField *
* @return javax.swing.JPasswordField */
private JPasswordField getJPasswordField() { if (jPasswordField == null) {
jPasswordField = new JPasswordField();
jPasswordField.setBounds(new Rectangle(154, 69, 94, 20));
jPasswordField.setText("creditcard");
}
return jPasswordField;
} /**
* This method initializes jPasswordField1 *
* @return javax.swing.JPasswordField */
private JPasswordField getJPasswordField1() { if (jPasswordField1 == null) {
jPasswordField1 = new JPasswordField();
jPasswordField1.setBounds(new Rectangle(152, 106, 94, 20));
jPasswordField1.setText("creditcards");
}
return jPasswordField1;
} /**
* This method initializes jButton *
* @return javax.swing.JButton */
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setBounds(new Rectangle(92, 143, 87, 19));
jButton.setText("submit");
}
return jButton;
} /**
* @param args */
public static void main(String[] args) { // TODO Auto-generated method stub
SwingUtilities.invokeLater(new Runnable() { public void run() {
amm thisClass = new amm();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
* This is the default constructor */
* This method initializes this *
* @return void */
private void initialize() {
this.setSize(187, 145);
this.setContentPane(getJContentPane());
this.setTitle("Payment");
} /**
* This method initializes jContentPane *
* @return javax.swing.JPanel */
private JPanel getJContentPane() { if (jContentPane == null) {
jLabel2 = new JLabel();
jLabel2.setBounds(new Rectangle(18, 105, 93, 16));
jLabel2.setText("TXN Password");
jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(19, 67, 81, 16));
jLabel1.setText("Password");
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(19, 30, 81, 16));
jLabel.setText("Pin_no");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(jLabel, null);
jContentPane.add(getJTextField(), null);
jContentPane.add(jLabel1, null);
jContentPane.add(getJPasswordField(), null);
jContentPane.add(jLabel2, null);
jContentPane.add(getJPasswordField1(), null);
jContentPane.add(getJButton(), null);
}
return jContentPane;
}
} // @jve:decl-index=0:visual-constraint="121,141"
RESULT:
Thus the user interface layers for Credit Card Processing is drawn successfully.