Gonzales Francois Combination of Lesson7-8 & Lesson9
Gonzales Francois Combination of Lesson7-8 & Lesson9
Subject: OCC101
Combination_Of_Lesson7-8_&_Lesson9
PROGRAM CODE:
package form_experiment;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
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,
int1, int2, int3, int4, int5, int6, int7, int8, int9, int10,
int11, int12, int13, int14, int15, int16, int17, int18, int19, int20;
txt11, txt12, txt13, txt14, txt15, txt16, txt17, txt18, txt19, txt20;
private static JButton loginButton, resetButton, display, exit, clear, bg1, bg2;
public Form_Experiment(){
setTitle("Login_Form");
contentPane.setBackground(Color.orange);
contentPane.setLayout(null);
//For Fill-Up
int16 = new JLabel("Favorite Color: "); txt16 = new JTextField("Blue, Red, Orange,
Black",15);
//Button
usernameLabel = new JLabel("UserName"); usernameText = new
JTextField("Francois1234");
bg1 = new JButton("SET FOR GIRL"); bg2 = new JButton("SET FOR BOY");
//For Display
showpasswordCheckBox.setBackground(Color.orange);
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
horline4 = new
JLabel("============================================================
==========================");
horline6 = new
JLabel("============================================================
==========================");
//Location
usernameLabel.setBounds(115,225,80,30);
usernameText.setBounds(150,250,270,30);
passwordLabel.setBounds(115,275,80,30);
passwordText.setBounds(150,300,270,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));
display.setFont(new Font("Arial",Font.ITALIC,16));
showpasswordCheckBox.setFont(new Font("Arial",Font.ITALIC,13));
//Login Button
loginButton.addActionListener(new ActionListener(){
@Override
JF2.setDefaultCloseOperation(JF2.HIDE_ON_CLOSE);
contentPane1.setBackground(Color.LIGHT_GRAY);
username = usernameText.getText();
password = passwordText.getText();
Form.setVisible(false);
JF2.setVisible(true);
JF2.setBounds(0, 0, 1290,760);
JF2.setResizable(false);
//Location
clear.setBounds(550,600, 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("")){
else{
});
//Reset Button
resetButton.addActionListener(new ActionListener(){
@Override
usernameText.setText("");passwordText.setText("");
});
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
});
//Exit Button
exit.addActionListener(new ActionListener(){
@Override
System.exit(0);
});
//Clear Button
clear.addActionListener(new ActionListener(){
@Override
});
//Backgroud Button1
bg1.addActionListener(new java.awt.event.ActionListener() {
@Override
contentPane1.setBackground(Color.PINK);
});
//Backgroud Button2
bg2.addActionListener(new java.awt.event.ActionListener() {
@Override
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);
Form.setVisible(true);
Form.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Form.setLocationRelativeTo(null);
Form.setResizable(false);
Form.add(contentPane);
+ "Section: 19BSIS1P\n\n"
+ "Course: BSIS");