0% found this document useful (0 votes)
17 views21 pages

Gonzales Francois Combination of Lesson7-8 & Lesson9

This document contains the program code for a Java GUI application that displays a login form with various input fields and labels. It defines multiple JLabels, JTextFields, JButtons and other Swing components to display the form elements. It also defines event handlers for the buttons. The form allows the user to enter personal information which is then displayed after logging in. The code sets the layout, locations, fonts and other properties of all the GUI components on the login and display forms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views21 pages

Gonzales Francois Combination of Lesson7-8 & Lesson9

This document contains the program code for a Java GUI application that displays a login form with various input fields and labels. It defines multiple JLabels, JTextFields, JButtons and other Swing components to display the form elements. It also defines event handlers for the buttons. The form allows the user to enter personal information which is then displayed after logging in. The code sets the layout, locations, fonts and other properties of all the GUI components on the login and display forms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Name: Gonzales, Francois M.

Subject: OCC101

Section: 19BSIS1P Prof: Marygin Sarmiento

Combination_Of_Lesson7-8_&_Lesson9

PROGRAM CODE:

package form_experiment;

import java.awt.*;

import javax.swing.*;

import java.awt.event.*;

public class Form_Experiment extends JFrame {

//For Input and Output Display Label

private static JLabel usernameLabel, passwordLabel, imageLabel,

verline1, verline2, verline3, verline4, verline5, verline6,

horline1, horline2, horline3, horline4, horline5, horline6,

dis1, dis2, dis3, dis4, dis5, dis6, dis7, dis8, dis9, dis10,

dis11, dis12, dis13, dis14, dis15, dis16, dis17, dis18, dis19, dis20,

info1, info2, info3, info4, info5, info6, info7, info8, info9, info10,

info11, info12, info13, info14, info15, info16, info17, info18, info19,


info20,

int1, int2, int3, int4, int5, int6, int7, int8, int9, int10,

int11, int12, int13, int14, int15, int16, int17, int18, int19, int20;

//For Input Display TextField and PasswordField


private static JTextField usernameText, txt1, txt2, txt3, txt4, txt5, txt6, txt7, txt8, txt9,
txt10,

txt11, txt12, txt13, txt14, txt15, txt16, txt17, txt18, txt19, txt20;

private static JPasswordField passwordText;

//For Command Button and CheckBox

private static JButton loginButton, resetButton, display, exit, clear, bg1, bg2;

private static JCheckBox showpasswordCheckBox;

//For Background Picture ImageIcon

private static ImageIcon icon;

//For Output Display String

private static String username, password,

input1, input2, input3, input4, input5, input6, input7, input8, input9,


input10,

input11, input12, input13, input14, input15, input16, input17, input18,


input19, input20;

private static Form_Experiment Form;

//For Layout Display Panel

private static JPanel contentPane, contentPane1;

public Form_Experiment(){

//For First Form Display Frame

setTitle("Login_Form");

contentPane = new JPanel();

contentPane.setBackground(Color.orange);

contentPane.setLayout(null);
//For Fill-Up

int1 = new JLabel("Last Name: "); txt1 = new JTextField("Gonzales",15);

int2 = new JLabel("First Name: "); txt2 = new JTextField("Francois",15);

int3 = new JLabel("Middle Name: "); txt3 = new JTextField("Mejia",15);

int4 = new JLabel("Sex: "); txt4 = new JTextField("Male",15);

int5 = new JLabel("Age: "); txt5 = new JTextField("19",15);

int6 = new JLabel("Day of Birth: "); txt6 = new JTextField("January 18,


2001",15);

int7 = new JLabel("Contact No#: "); txt7 = new JTextField("09076309644",15);

int8 = new JLabel("Email: "); txt8 = new


JTextField("[email protected]",15);

int9 = new JLabel("Talent: "); txt9 = new JTextField("Poetry",15);

int10 = new JLabel("Hobby: "); txt10 = new JTextField("Writting Poetry",15);

int11 = new JLabel("House No#/Street: ");txt11 = new JTextField("084, Madera


Homes1, Narra St.",15);

int12 = new JLabel("Barangay: "); txt12 = new JTextField("San Roque",15);

int13 = new JLabel("Municipal/City: "); txt13 = new JTextField("Cainta",15);

int14 = new JLabel("Province: "); txt14 = new JTextField("Rizal",15);

int15 = new JLabel("Religion: "); txt15 = new JTextField("Catholic",15);

int16 = new JLabel("Favorite Color: "); txt16 = new JTextField("Blue, Red, Orange,
Black",15);

int17 = new JLabel("Favorite Food: "); txt17 = new JTextField("Qwek - qwek",15);

int18 = new JLabel("Favorite Animal: "); txt18 = new JTextField("Dog",15);

int19 = new JLabel("Favorite Number: "); txt19 = new JTextField("18",15);

int20 = new JLabel("Favorite Person: "); txt20 = new JTextField("You",15);

//Button
usernameLabel = new JLabel("UserName"); usernameText = new
JTextField("Francois1234");

passwordLabel = new JLabel("Password"); passwordText = new


JPasswordField("Mypassword");

loginButton = new JButton("Login"); resetButton = new JButton("Reset");

display = new JButton("DISPLAY ALL"); exit = new JButton("EXIT");

clear = new JButton("CLEAR"); showpasswordCheckBox = new


JCheckBox("Show Password");

bg1 = new JButton("SET FOR GIRL"); bg2 = new JButton("SET FOR BOY");

//For Display

icon = new ImageIcon(getClass().getResource("icon.png"));

imageLabel = new JLabel(icon);

showpasswordCheckBox.setBackground(Color.orange);

dis1 = new JLabel("Last Name: "); info1 = new JLabel();

dis2 = new JLabel("First Name: "); info2 = new JLabel();

dis3 = new JLabel("Middle Name: "); info3 = new JLabel();

dis4 = new JLabel("Sex: "); info4 = new JLabel();

dis5 = new JLabel("Age: "); info5 = new JLabel();

dis6 = new JLabel("Day of Birth: "); info6 = new JLabel();

dis7 = new JLabel("Contact No#: "); info7 = new JLabel();

dis8 = new JLabel("Email: "); info8 = new JLabel();

dis9 = new JLabel("Talent: "); info9 = new JLabel();

dis10 = new JLabel("Hobby: "); info10 = new JLabel();

dis11 = new JLabel("House No#/Street: ");info11 = new JLabel();


dis12 = new JLabel("Barangay: "); info12 = new JLabel();

dis13 = new JLabel("Municipal/City: "); info13 = new JLabel();

dis14 = new JLabel("Province: "); info14 = new JLabel();

dis15 = new JLabel("Religion: "); info15 = new JLabel();

dis16 = new JLabel("Favorite Color: "); info16 = new JLabel();

dis17 = new JLabel("Favorite Food: "); info17 = new JLabel();

dis18 = new JLabel("Favorite Animal: "); info18 = new JLabel();

dis19 = new JLabel("Favorite Number: "); info19 = new JLabel();

dis20 = new JLabel("Favorite Person: "); info20 = new JLabel();

//Border Line Vertical

verline3 = new JLabel("<html>|<br><br><br>|<br><br><br>|<br><br><br>|


<br><br><br>|<br><br><br>|<br><br><br>|<br><br><br>|<br><br><br>|<br><br><br>|
<br><br><br>|</html>");

verline4 = new JLabel("<html>|<br><br><br>|<br><br><br>|<br><br><br>|


<br><br><br>|<br><br><br>|<br><br><br>|<br><br><br>|<br><br><br>|<br><br><br>|
</html>");

verline5 = new JLabel("<html>|<br><br><br>|<br><br><br>|<br><br><br>|


<br><br><br>|<br><br><br>|<br><br><br>|<br><br><br>|<br><br><br>|<br><br><br>|
</html>");

verline6 = new JLabel("<html>|<br><br><br>|<br><br><br>|<br><br><br>|


<br><br><br>|<br><br><br>|<br><br><br>|<br><br><br>|<br><br><br>|<br><br><br>|
<br><br><br>|</html>");

verline1 = new
JLabel("<html>+<br>+<br>+<br>+<br>+<br>+<br>+<br>+<br>+<br>+<br>+<br>+</
html>");

verline2 = new
JLabel("<html>+<br>+<br>+<br>+<br>+<br>+<br>+<br>+<br>+<br>+<br>+<br>+</
html>");
//Border Line Horizontal

horline3 = new JLabel("==================================== FORM


FILL - UP ====================================");

horline4 = new
JLabel("============================================================
==========================");

horline5 = new JLabel("================================== YOUR


INFORMATION ==================================");

horline6 = new
JLabel("============================================================
==========================");

horline1 = new JLabel("<html>+ + + + + + + + + + + + + + + + + + + + + + + + + + +


+ + + +</html>");

horline2 = new JLabel("<html>+ + + + + + + + + + + + + + + + + + + + + + + + + + +


+ + + +</html>");

//Location

verline1.setBounds(83,215, 50,200); verline2.setBounds(443,215, 50,200);

horline1.setBounds(83,190, 1000, 30); horline2.setBounds(83,410, 1000,30);

usernameLabel.setBounds(115,225,80,30);
usernameText.setBounds(150,250,270,30);

passwordLabel.setBounds(115,275,80,30);
passwordText.setBounds(150,300,270,30);

loginButton.setBounds(150, 370, 100, 30); resetButton.setBounds(300, 370, 100,


30);

imageLabel.setBounds(0,0, 540,170);
showpasswordCheckBox.setBounds(175, 330, 120, 30);

//Font
usernameText.setFont(new Font("Arial",Font.ITALIC,16));
passwordText.setFont(new Font("Arial",Font.ITALIC,16));

usernameLabel.setFont(new Font("Arial",Font.ITALIC,16));
passwordLabel.setFont(new Font("Arial",Font.ITALIC,16));

loginButton.setFont(new Font("Arial",Font.ITALIC,15)); resetButton.setFont(new


Font("Arial",Font.ITALIC,15));

display.setFont(new Font("Arial",Font.ITALIC,16));
showpasswordCheckBox.setFont(new Font("Arial",Font.ITALIC,13));

clear.setFont(new Font("Arial",Font.ITALIC,16)); exit.setFont(new


Font("Arial",Font.ITALIC,16));

bg1.setFont(new Font("Arial",Font.ITALIC,16)); bg2.setFont(new


Font("Arial",Font.ITALIC,15));

txt1.setFont(new Font("Arial",Font.ITALIC,13)); info1.setFont(new


Font("Arial",Font.ITALIC,13));

txt2.setFont(new Font("Arial",Font.ITALIC,13)); info2.setFont(new


Font("Arial",Font.ITALIC,13));

txt3.setFont(new Font("Arial",Font.ITALIC,13)); info3.setFont(new


Font("Arial",Font.ITALIC,13));

txt4.setFont(new Font("Arial",Font.ITALIC,13)); info4.setFont(new


Font("Arial",Font.ITALIC,13));

txt5.setFont(new Font("Arial",Font.ITALIC,13)); info5.setFont(new


Font("Arial",Font.ITALIC,13));

txt6.setFont(new Font("Arial",Font.ITALIC,13)); info6.setFont(new


Font("Arial",Font.ITALIC,13));

txt7.setFont(new Font("Arial",Font.ITALIC,13)); info7.setFont(new


Font("Arial",Font.ITALIC,13));
txt8.setFont(new Font("Arial",Font.ITALIC,13)); info8.setFont(new
Font("Arial",Font.ITALIC,13));

txt9.setFont(new Font("Arial",Font.ITALIC,13)); info9.setFont(new


Font("Arial",Font.ITALIC,13));

txt10.setFont(new Font("Arial",Font.ITALIC,13)); info10.setFont(new


Font("Arial",Font.ITALIC,13));

txt11.setFont(new Font("Arial",Font.ITALIC,13)); info11.setFont(new


Font("Arial",Font.ITALIC,13));

txt12.setFont(new Font("Arial",Font.ITALIC,13)); info12.setFont(new


Font("Arial",Font.ITALIC,13));

txt13.setFont(new Font("Arial",Font.ITALIC,13)); info13.setFont(new


Font("Arial",Font.ITALIC,13));

txt14.setFont(new Font("Arial",Font.ITALIC,13)); info14.setFont(new


Font("Arial",Font.ITALIC,13));

txt15.setFont(new Font("Arial",Font.ITALIC,13)); info15.setFont(new


Font("Arial",Font.ITALIC,13));

txt16.setFont(new Font("Arial",Font.ITALIC,13)); info16.setFont(new


Font("Arial",Font.ITALIC,13));

txt17.setFont(new Font("Arial",Font.ITALIC,13)); info17.setFont(new


Font("Arial",Font.ITALIC,13));

txt18.setFont(new Font("Arial",Font.ITALIC,13)); info18.setFont(new


Font("Arial",Font.ITALIC,13));

txt19.setFont(new Font("Arial",Font.ITALIC,13)); info19.setFont(new


Font("Arial",Font.ITALIC,13));

txt20.setFont(new Font("Arial",Font.ITALIC,13)); info20.setFont(new


Font("Arial",Font.ITALIC,13));

dis1.setFont(new Font("Arial",Font.ITALIC,14)); int1.setFont(new


Font("Arial",Font.ITALIC,14));

dis2.setFont(new Font("Arial",Font.ITALIC,14)); int2.setFont(new


Font("Arial",Font.ITALIC,14));
dis3.setFont(new Font("Arial",Font.ITALIC,14)); int3.setFont(new
Font("Arial",Font.ITALIC,14));

dis4.setFont(new Font("Arial",Font.ITALIC,14)); int4.setFont(new


Font("Arial",Font.ITALIC,14));

dis5.setFont(new Font("Arial",Font.ITALIC,14)); int5.setFont(new


Font("Arial",Font.ITALIC,14));

dis6.setFont(new Font("Arial",Font.ITALIC,14)); int6.setFont(new


Font("Arial",Font.ITALIC,14));

dis7.setFont(new Font("Arial",Font.ITALIC,14)); int7.setFont(new


Font("Arial",Font.ITALIC,14));

dis8.setFont(new Font("Arial",Font.ITALIC,14)); int8.setFont(new


Font("Arial",Font.ITALIC,14));

dis9.setFont(new Font("Arial",Font.ITALIC,14)); int9.setFont(new


Font("Arial",Font.ITALIC,14));

dis10.setFont(new Font("Arial",Font.ITALIC,14)); int10.setFont(new


Font("Arial",Font.ITALIC,14));

dis11.setFont(new Font("Arial",Font.ITALIC,14)); int11.setFont(new


Font("Arial",Font.ITALIC,14));

dis12.setFont(new Font("Arial",Font.ITALIC,14)); int12.setFont(new


Font("Arial",Font.ITALIC,14));

dis13.setFont(new Font("Arial",Font.ITALIC,14)); int13.setFont(new


Font("Arial",Font.ITALIC,14));

dis14.setFont(new Font("Arial",Font.ITALIC,14)); int14.setFont(new


Font("Arial",Font.ITALIC,14));

dis15.setFont(new Font("Arial",Font.ITALIC,14)); int15.setFont(new


Font("Arial",Font.ITALIC,14));

dis16.setFont(new Font("Arial",Font.ITALIC,14)); int16.setFont(new


Font("Arial",Font.ITALIC,14));

dis17.setFont(new Font("Arial",Font.ITALIC,14)); int17.setFont(new


Font("Arial",Font.ITALIC,14));
dis18.setFont(new Font("Arial",Font.ITALIC,14)); int18.setFont(new
Font("Arial",Font.ITALIC,14));

dis19.setFont(new Font("Arial",Font.ITALIC,14)); int19.setFont(new


Font("Arial",Font.ITALIC,14));

dis20.setFont(new Font("Arial",Font.ITALIC,14)); int20.setFont(new


Font("Arial",Font.ITALIC,14));

verline1.setFont(new Font("Arial",Font.ITALIC,14)); verline2.setFont(new


Font("Arial",Font.ITALIC,14));

verline3.setFont(new Font("Arial",Font.ITALIC,14)); verline5.setFont(new


Font("Arial",Font.ITALIC,14));

verline4.setFont(new Font("Arial",Font.ITALIC,14)); verline6.setFont(new


Font("Arial",Font.ITALIC,14));

horline1.setFont(new Font("Arial",Font.ITALIC,14)); horline2.setFont(new


Font("Arial",Font.ITALIC,14));

horline3.setFont(new Font("Arial",Font.ITALIC,12)); horline5.setFont(new


Font("Arial",Font.ITALIC,12));

horline4.setFont(new Font("Arial",Font.ITALIC,12)); horline6.setFont(new


Font("Arial",Font.ITALIC,12));

//Login Button

loginButton.addActionListener(new ActionListener(){

@Override

public void actionPerformed(ActionEvent e){

//For Second Form Display Frame

final JFrame JF2 = new JFrame("Fill-Up_Form");

JF2.setDefaultCloseOperation(JF2.HIDE_ON_CLOSE);

contentPane1 = new JPanel();


contentPane1.setLayout(null);

contentPane1.setBackground(Color.LIGHT_GRAY);

username = usernameText.getText();

password = passwordText.getText();

if(username.equals("Francois1234") && password.equals("Mypassword")){

JOptionPane.showMessageDialog(null, "Login Successful!");

Form.setVisible(false);

JF2.setVisible(true);

JF2.setBounds(0, 0, 1290,760);

JF2.setResizable(false);

//Location

int1.setBounds(50,50, 250,30); txt1.setBounds(50,75, 250,30);

int2.setBounds(50,100, 250,30); txt2.setBounds(50,125, 250,30);

int3.setBounds(50,150, 250,30); txt3.setBounds(50,175, 250,30);

int4.setBounds(50,200, 250,30); txt4.setBounds(50,225, 250,30);

int5.setBounds(50,250, 250,30); txt5.setBounds(50,275, 250,30);

int6.setBounds(50,300, 250,30); txt6.setBounds(50,325, 250,30);

int7.setBounds(50,350, 250,30); txt7.setBounds(50,375, 250,30);

int8.setBounds(50,400, 250,30); txt8.setBounds(50,425, 250,30);

int9.setBounds(50,450, 250,30); txt9.setBounds(50,475, 250,30);

int10.setBounds(50,500, 250,30); txt10.setBounds(50,525, 250,30);


int11.setBounds(350,50, 250,30); txt11.setBounds(350,75, 250,30);

int12.setBounds(350,100, 250,30); txt12.setBounds(350,125, 250,30);

int13.setBounds(350,150, 250,30); txt13.setBounds(350,175, 250,30);

int14.setBounds(350,200, 250,30); txt14.setBounds(350,225, 250,30);

int15.setBounds(350,250, 250,30); txt15.setBounds(350,275, 250,30);

int16.setBounds(350,300, 250,30); txt16.setBounds(350,325, 250,30);

int17.setBounds(350,350, 250,30); txt17.setBounds(350,375, 250,30);

int18.setBounds(350,400, 250,30); txt18.setBounds(350,425, 250,30);

int19.setBounds(350,450, 250,30); txt19.setBounds(350,475, 250,30);

int20.setBounds(350,500, 250,30); txt20.setBounds(350,525, 250,30);

verline3.setBounds(625,25, 250,550); verline4.setBounds(25,25, 250,550);

horline3.setBounds(25,25, 3000,30); horline4.setBounds(25,550,


3000,30);

display.setBounds(250,600, 200,50); exit.setBounds(850,600, 200,50);

clear.setBounds(550,600, 200,50);

bg1.setBounds(400,675, 200,50); bg2.setBounds(700,675, 200,50);

contentPane1.add(int1); contentPane1.add(txt1);

contentPane1.add(int2); contentPane1.add(txt2);

contentPane1.add(int3); contentPane1.add(txt3);

contentPane1.add(int4); contentPane1.add(txt4);
contentPane1.add(int5); contentPane1.add(txt5);

contentPane1.add(int6); contentPane1.add(txt6);

contentPane1.add(int7); contentPane1.add(txt7);

contentPane1.add(int8); contentPane1.add(txt8);

contentPane1.add(int9); contentPane1.add(txt9);

contentPane1.add(int10); contentPane1.add(txt10);

contentPane1.add(int11); contentPane1.add(txt11);

contentPane1.add(int12); contentPane1.add(txt12);

contentPane1.add(int13); contentPane1.add(txt13);

contentPane1.add(int14); contentPane1.add(txt14);

contentPane1.add(int15); contentPane1.add(txt15);

contentPane1.add(int16); contentPane1.add(txt16);

contentPane1.add(int17); contentPane1.add(txt17);

contentPane1.add(int18); contentPane1.add(txt18);

contentPane1.add(int19); contentPane1.add(txt19);

contentPane1.add(int20); contentPane1.add(txt20);

contentPane1.add(display); contentPane1.add(exit);

contentPane1.add(clear);

contentPane1.add(bg1); contentPane1.add(bg2);

contentPane1.add(dis1); contentPane1.add(info1);

contentPane1.add(dis2); contentPane1.add(info2);

contentPane1.add(dis3); contentPane1.add(info3);
contentPane1.add(dis4); contentPane1.add(info4);

contentPane1.add(dis5); contentPane1.add(info5);

contentPane1.add(dis6); contentPane1.add(info6);

contentPane1.add(dis7); contentPane1.add(info7);

contentPane1.add(dis8); contentPane1.add(info8);

contentPane1.add(dis9); contentPane1.add(info9);

contentPane1.add(dis10); contentPane1.add(info10);

contentPane1.add(dis11); contentPane1.add(info11);

contentPane1.add(dis12); contentPane1.add(info12);

contentPane1.add(dis13); contentPane1.add(info13);

contentPane1.add(dis14); contentPane1.add(info14);

contentPane1.add(dis15); contentPane1.add(info15);

contentPane1.add(dis16); contentPane1.add(info16);

contentPane1.add(dis17); contentPane1.add(info17);

contentPane1.add(dis18); contentPane1.add(info18);

contentPane1.add(dis19); contentPane1.add(info19);

contentPane1.add(dis20); contentPane1.add(info20);

contentPane1.add(horline3); contentPane1.add(horline4);

contentPane1.add(horline5); contentPane1.add(horline6);

contentPane1.add(verline3); contentPane1.add(verline4);

contentPane1.add(verline5); contentPane1.add(verline6);

JF2.add(contentPane1);

}
else if(!(username.equals("")) && password.equals("")){

JOptionPane.showMessageDialog(null, "Password is empty");

else if(username.equals("") && !(password.equals(""))){

JOptionPane.showMessageDialog(null, "UserName is empty");

else if(username.equals("") && password.equals("")){

JOptionPane.showMessageDialog(null, "UserName and Password is


empty");

else{

JOptionPane.showMessageDialog(null, "Invalid! Please check UserName


and Password");

});

//Reset Button

resetButton.addActionListener(new ActionListener(){

@Override

public void actionPerformed(ActionEvent e){

usernameText.setText("");passwordText.setText("");

});

//Show Password CheckBox

showpasswordCheckBox.addActionListener(new ActionListener(){

@Override
public void actionPerformed(ActionEvent e){

if (e.getSource() == showpasswordCheckBox) {

if (showpasswordCheckBox.isSelected()) {

passwordText.setEchoChar((char) 0);

else {

passwordText.setEchoChar('*');

});

//Display Button

display.addActionListener(new ActionListener(){

@Override

public void actionPerformed(ActionEvent e){

dis1.setBounds(675,50, 400,30); info1.setBounds(800,50, 400,30);

dis2.setBounds(675,75, 400,30); info2.setBounds(800,75, 400,30);

dis3.setBounds(675,100, 400,30); info3.setBounds(800,100, 400,30);

dis4.setBounds(675,125, 400,30); info4.setBounds(800,125, 400,30);

dis5.setBounds(675,150, 400,30); info5.setBounds(800,150, 400,30);

dis6.setBounds(675,175, 400,30); info6.setBounds(800,175, 400,30);

dis7.setBounds(675,200, 400,30); info7.setBounds(800,200, 400,30);

dis8.setBounds(675,225, 400,30); info8.setBounds(800,225, 400,30);

dis9.setBounds(675,250, 400,30); info9.setBounds(800,250, 400,30);


dis10.setBounds(675,275, 400,30); info10.setBounds(800,275, 400,30);

dis11.setBounds(675,300, 400,30); info11.setBounds(800,300, 400,30);

dis12.setBounds(675,325, 400,30); info12.setBounds(800,325, 400,30);

dis13.setBounds(675,350, 400,30); info13.setBounds(800,350, 400,30);

dis14.setBounds(675,375, 400,30); info14.setBounds(800,375, 400,30);

dis15.setBounds(675,400, 400,30); info15.setBounds(800,400, 400,30);

dis16.setBounds(675,425, 400,30); info16.setBounds(800,425, 400,30);

dis17.setBounds(675,450, 400,30); info17.setBounds(800,450, 400,30);

dis18.setBounds(675,475, 400,30); info18.setBounds(800,475, 400,30);

dis19.setBounds(675,500, 400,30); info19.setBounds(800,500, 400,30);

dis20.setBounds(675,525, 400,30); info20.setBounds(800,525, 400,30);

horline5.setBounds(650,25, 3000,30);horline6.setBounds(650,550, 3000,30);

verline5.setBounds(650,25, 250,550);verline6.setBounds(1250,25, 250,550);

System.out.println(dis1); input1 = txt1.getText(); info1.setText(input1);

System.out.println(dis2); input2 = txt2.getText(); info2.setText(input2);

System.out.println(dis3); input3 = txt3.getText(); info3.setText(input3);

System.out.println(dis4); input4 = txt4.getText(); info4.setText(input4);

System.out.println(dis5); input5 = txt5.getText(); info5.setText(input5);

System.out.println(dis6); input6 = txt6.getText(); info6.setText(input6);

System.out.println(dis7); input7 = txt7.getText(); info7.setText(input7);

System.out.println(dis8); input8 = txt8.getText(); info8.setText(input8);

System.out.println(dis9); input9 = txt9.getText(); info9.setText(input9);


System.out.println(dis10); input10 = txt10.getText(); info10.setText(input10);

System.out.println(dis11); input11 = txt11.getText(); info11.setText(input11);

System.out.println(dis12); input12 = txt12.getText(); info12.setText(input12);

System.out.println(dis13); input13 = txt13.getText(); info13.setText(input13);

System.out.println(dis14); input14 = txt14.getText(); info14.setText(input14);

System.out.println(dis15); input15 = txt15.getText(); info15.setText(input15);

System.out.println(dis16); input16 = txt16.getText(); info16.setText(input16);

System.out.println(dis17); input17 = txt17.getText(); info17.setText(input17);

System.out.println(dis18); input18 = txt18.getText(); info18.setText(input18);

System.out.println(dis19); input19 = txt19.getText(); info19.setText(input19);

System.out.println(dis20); input20 = txt20.getText(); info20.setText(input20);

});

//Exit Button

exit.addActionListener(new ActionListener(){

@Override

public void actionPerformed(ActionEvent e){

JOptionPane.showMessageDialog(null,"Thank you for using my program!");

System.exit(0);

});

//Clear Button

clear.addActionListener(new ActionListener(){

@Override

public void actionPerformed(ActionEvent e){


txt1.setText(""); txt2.setText(""); txt3.setText(""); txt4.setText("");
txt5.setText("");

txt6.setText(""); txt7.setText(""); txt8.setText(""); txt9.setText("");


txt10.setText("");

txt11.setText(""); txt12.setText(""); txt13.setText(""); txt14.setText("");


txt15.setText("");

txt16.setText(""); txt17.setText(""); txt18.setText(""); txt19.setText("");


txt20.setText("");

info1.setText(""); info2.setText(""); info3.setText(""); info4.setText("");


info5.setText("");

info6.setText(""); info7.setText(""); info8.setText(""); info9.setText("");


info10.setText("");

info11.setText(""); info12.setText(""); info13.setText(""); info14.setText("");


info15.setText("");

info16.setText(""); info17.setText(""); info18.setText(""); info19.setText("");


info20.setText("");

});

//Backgroud Button1

bg1.addActionListener(new java.awt.event.ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

contentPane1.setBackground(Color.PINK);

});

//Backgroud Button2

bg2.addActionListener(new java.awt.event.ActionListener() {
@Override

public void actionPerformed(ActionEvent e) {

contentPane1.setBackground(Color.CYAN);

});

//To display

contentPane.add(usernameLabel); contentPane.add(usernameText);

contentPane.add(passwordLabel); contentPane.add(passwordText);

contentPane.add(imageLabel); contentPane.add(showpasswordCheckBox);

contentPane.add(loginButton); contentPane.add(resetButton);

contentPane.add(horline1); contentPane.add(horline2);

contentPane.add(verline1); contentPane.add(verline2);

public static void main(String[] args) {

Form = new Form_Experiment();

Form.setVisible(true);

Form.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

Form.setLocationRelativeTo(null);

Form.setBounds(380, 150, 545, 490);

Form.setResizable(false);

Form.add(contentPane);

JOptionPane.showMessageDialog(null, "Welcome to my Program\n\n"

+ "Name: Francois M. Gonzales\n\n"

+ "Section: 19BSIS1P\n\n"
+ "Course: BSIS");

You might also like