SlideShare a Scribd company logo
1 of 9
Download to read offline
// JPasswordA.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Color;
public class JPasswordA extends JApplet implements ActionListener
{
JLabel inputPassword = new JLabel("Input a password!");
Font firstFont = new Font("Arial", Font.ITALIC, 54);
Font secondFOnt = new Font("Arial", Font.BOLD, 54);
JTextField result = new JTextField(2);
JButton Input = new JButton("Input");
JLabel checkGranted = new JLabel("Access Granted!");
JLabel checkDenied = new JLabel("Access Denied!");
Container containeeer = getContentPane();
public void init()
{
containeeer.setLayout(new FlowLayout());
inputPassword.setFont(firstFont);
checkGranted.setFont(secondFOnt);
checkDenied.setFont(secondFOnt);
containeeer.add(inputPassword);
containeeer.add(result);
containeeer.add(Input);
containeeer.setBackground(Color.RED);
Input.addActionListener(this);
result.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
String userPassword = result.getText();
containeeer.remove(inputPassword);
containeeer.remove(Input);
containeeer.remove(result);
if(userPassword.equals("Rosebud"))
{
containeeer.setBackground(Color.BLUE);
containeeer.add(checkGranted);
}
else
{
containeeer.setBackground(Color.GREEN);
containeeer.add(checkDenied);
}
validate();
}
}
//JPasswordB.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Color;
public class JPasswordB extends JApplet implements ActionListener
{
JLabel inputPassword = new JLabel("input a password!");
Font firstFont = new Font("Arial", Font.BOLD, 54);
Font sencondFont = new Font("Arial", Font.BOLD, 54);
JTextField result = new JTextField(20);
JButton input = new JButton("input");
JLabel checkGranted = new JLabel("Access Granted!");
JLabel checkDenied = new JLabel("Access Denied!");
Container containeeer = getContentPane();
public void init()
{
containeeer.setLayout(new FlowLayout());
inputPassword.setFont(firstFont);
checkGranted.setFont(sencondFont);
checkDenied.setFont(sencondFont);
containeeer.add(inputPassword);
containeeer.add(result);
containeeer.add(input);
containeeer.setBackground(Color.RED);
input.addActionListener(this);
result.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
String userPassword = result.getText();
containeeer.remove(inputPassword);
containeeer.remove(input);
containeeer.remove(result);
if(userPassword.equalsIgnoreCase("Rosebud"))
{
containeeer.setBackground(Color.BLUE);
containeeer.add(checkGranted);
}
else
{
containeeer.setBackground(Color.GREEN);
containeeer.add(denied);
}
validate();
}
}
// JPasswordC.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Color;
public class JPasswordC extends JApplet implements ActionListener
{
JLabel inputPassword = new JLabel("Please enter a password!");
Font firstFont = new Font("Arial", Font.ITALIC, 34);
Font sencondFont = new Font("Arial", Font.BOLD, 46);
JTextField result = new JTextField(10);
JButton enter = new JButton("Enter");
JLabel checkGranted = new JLabel("Access Granted!");
JLabel checkDenied = new JLabel("Access Denied!");
Container containeeer = getContentPane();
public void init()
{
containeeer.setLayout(new FlowLayout());
inputPassword.setFont(firstFont);
checkGranted.setFont(sencondFont);
checkDenied.setFont(sencondFont);
containeeer.add(inputPassword);
containeeer.add(result);
containeeer.add(enter);
containeeer.setBackground(Color.RED);
enter.addActionListener(this);
result.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
String userPassword = result.getText();
containeeer.remove(inputPassword);
containeeer.remove(enter);
containeeer.remove(result);
if(userPassword.equalsIgnoreCase("Rosebud")||
userPassword.equalsIgnoreCase("Redrum")|| userPassword.equalsIgnoreCase("Jason")||
userPassword.equalsIgnoreCase("Surrender")|| userPassword.equalsIgnoreCase("Dorothy"))
{
containeeer.setBackground(Color.BLUE);
containeeer.add(checkGranted);
}
else
{
containeeer.setBackground(Color.GREEN);
containeeer.add(checkDenied);
}
validate();
}
}
Solution
// JPasswordA.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Color;
public class JPasswordA extends JApplet implements ActionListener
{
JLabel inputPassword = new JLabel("Input a password!");
Font firstFont = new Font("Arial", Font.ITALIC, 54);
Font secondFOnt = new Font("Arial", Font.BOLD, 54);
JTextField result = new JTextField(2);
JButton Input = new JButton("Input");
JLabel checkGranted = new JLabel("Access Granted!");
JLabel checkDenied = new JLabel("Access Denied!");
Container containeeer = getContentPane();
public void init()
{
containeeer.setLayout(new FlowLayout());
inputPassword.setFont(firstFont);
checkGranted.setFont(secondFOnt);
checkDenied.setFont(secondFOnt);
containeeer.add(inputPassword);
containeeer.add(result);
containeeer.add(Input);
containeeer.setBackground(Color.RED);
Input.addActionListener(this);
result.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
String userPassword = result.getText();
containeeer.remove(inputPassword);
containeeer.remove(Input);
containeeer.remove(result);
if(userPassword.equals("Rosebud"))
{
containeeer.setBackground(Color.BLUE);
containeeer.add(checkGranted);
}
else
{
containeeer.setBackground(Color.GREEN);
containeeer.add(checkDenied);
}
validate();
}
}
//JPasswordB.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Color;
public class JPasswordB extends JApplet implements ActionListener
{
JLabel inputPassword = new JLabel("input a password!");
Font firstFont = new Font("Arial", Font.BOLD, 54);
Font sencondFont = new Font("Arial", Font.BOLD, 54);
JTextField result = new JTextField(20);
JButton input = new JButton("input");
JLabel checkGranted = new JLabel("Access Granted!");
JLabel checkDenied = new JLabel("Access Denied!");
Container containeeer = getContentPane();
public void init()
{
containeeer.setLayout(new FlowLayout());
inputPassword.setFont(firstFont);
checkGranted.setFont(sencondFont);
checkDenied.setFont(sencondFont);
containeeer.add(inputPassword);
containeeer.add(result);
containeeer.add(input);
containeeer.setBackground(Color.RED);
input.addActionListener(this);
result.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
String userPassword = result.getText();
containeeer.remove(inputPassword);
containeeer.remove(input);
containeeer.remove(result);
if(userPassword.equalsIgnoreCase("Rosebud"))
{
containeeer.setBackground(Color.BLUE);
containeeer.add(checkGranted);
}
else
{
containeeer.setBackground(Color.GREEN);
containeeer.add(denied);
}
validate();
}
}
// JPasswordC.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Color;
public class JPasswordC extends JApplet implements ActionListener
{
JLabel inputPassword = new JLabel("Please enter a password!");
Font firstFont = new Font("Arial", Font.ITALIC, 34);
Font sencondFont = new Font("Arial", Font.BOLD, 46);
JTextField result = new JTextField(10);
JButton enter = new JButton("Enter");
JLabel checkGranted = new JLabel("Access Granted!");
JLabel checkDenied = new JLabel("Access Denied!");
Container containeeer = getContentPane();
public void init()
{
containeeer.setLayout(new FlowLayout());
inputPassword.setFont(firstFont);
checkGranted.setFont(sencondFont);
checkDenied.setFont(sencondFont);
containeeer.add(inputPassword);
containeeer.add(result);
containeeer.add(enter);
containeeer.setBackground(Color.RED);
enter.addActionListener(this);
result.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
String userPassword = result.getText();
containeeer.remove(inputPassword);
containeeer.remove(enter);
containeeer.remove(result);
if(userPassword.equalsIgnoreCase("Rosebud")||
userPassword.equalsIgnoreCase("Redrum")|| userPassword.equalsIgnoreCase("Jason")||
userPassword.equalsIgnoreCase("Surrender")|| userPassword.equalsIgnoreCase("Dorothy"))
{
containeeer.setBackground(Color.BLUE);
containeeer.add(checkGranted);
}
else
{
containeeer.setBackground(Color.GREEN);
containeeer.add(checkDenied);
}
validate();
}
}

More Related Content

Similar to JPasswordA.javaimport javax.swing.; import java.awt.; imp.pdf

20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
AliHaiderCheema2
 
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdfimport java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
anupambedcovers
 
import java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdf
import java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdfimport java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdf
import java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdf
galagirishp
 
correct the error and add code same in the pic import jav.pdf
correct the error and add code same in the pic   import jav.pdfcorrect the error and add code same in the pic   import jav.pdf
correct the error and add code same in the pic import jav.pdf
devangmittal4
 
Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3
martha leon
 
Registro de venta
Registro de ventaRegistro de venta
Registro de venta
lupe ga
 
Main class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdfMain class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdf
anushkaent7
 
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdfimport java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
venkt12345
 
Revision c odesagain
Revision c odesagainRevision c odesagain
Revision c odesagain
rex0721
 
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdfpackage net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
sudhirchourasia86
 
Program-a. library is importedimport java.awt.; import j.pdf
Program-a. library is importedimport java.awt.; import j.pdfProgram-a. library is importedimport java.awt.; import j.pdf
Program-a. library is importedimport java.awt.; import j.pdf
aparnacollection
 
correct the error and test the code import java.awt.event.Actio.pdf
 correct the  error and test the code import java.awt.event.Actio.pdf correct the  error and test the code import java.awt.event.Actio.pdf
correct the error and test the code import java.awt.event.Actio.pdf
almaniaeyewear
 
Please let me know if you need more clarification.final String pat.pdf
Please let me know if you need more clarification.final String pat.pdfPlease let me know if you need more clarification.final String pat.pdf
Please let me know if you need more clarification.final String pat.pdf
anjaniar7gallery
 
Tugas Praktikum Java 2
Tugas Praktikum Java 2Tugas Praktikum Java 2
Tugas Praktikum Java 2
azmi007
 

Similar to JPasswordA.javaimport javax.swing.; import java.awt.; imp.pdf (20)

20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
 
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdfimport java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
 
import java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdf
import java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdfimport java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdf
import java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdf
 
correct the error and add code same in the pic import jav.pdf
correct the error and add code same in the pic   import jav.pdfcorrect the error and add code same in the pic   import jav.pdf
correct the error and add code same in the pic import jav.pdf
 
Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3
 
Registro de venta
Registro de ventaRegistro de venta
Registro de venta
 
Main class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdfMain class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdf
 
Notepad
NotepadNotepad
Notepad
 
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdfimport java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
 
Java
JavaJava
Java
 
Revision c odesagain
Revision c odesagainRevision c odesagain
Revision c odesagain
 
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdfpackage net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
 
Program-a. library is importedimport java.awt.; import j.pdf
Program-a. library is importedimport java.awt.; import j.pdfProgram-a. library is importedimport java.awt.; import j.pdf
Program-a. library is importedimport java.awt.; import j.pdf
 
Chat application in java using swing and socket programming.
Chat application in java using swing and socket programming.Chat application in java using swing and socket programming.
Chat application in java using swing and socket programming.
 
correct the error and test the code import java.awt.event.Actio.pdf
 correct the  error and test the code import java.awt.event.Actio.pdf correct the  error and test the code import java.awt.event.Actio.pdf
correct the error and test the code import java.awt.event.Actio.pdf
 
Please let me know if you need more clarification.final String pat.pdf
Please let me know if you need more clarification.final String pat.pdfPlease let me know if you need more clarification.final String pat.pdf
Please let me know if you need more clarification.final String pat.pdf
 
Groovy-er desktop applications with Griffon
Groovy-er desktop applications with GriffonGroovy-er desktop applications with Griffon
Groovy-er desktop applications with Griffon
 
Groovy-er Desktop Applications With Griffon
Groovy-er Desktop Applications With GriffonGroovy-er Desktop Applications With Griffon
Groovy-er Desktop Applications With Griffon
 
Easy Button
Easy ButtonEasy Button
Easy Button
 
Tugas Praktikum Java 2
Tugas Praktikum Java 2Tugas Praktikum Java 2
Tugas Praktikum Java 2
 

More from anoopkhandelwal30

New Haven is a city and a housing finance firm started in the city w.pdf
New Haven is a city and a housing finance firm started in the city w.pdfNew Haven is a city and a housing finance firm started in the city w.pdf
New Haven is a city and a housing finance firm started in the city w.pdf
anoopkhandelwal30
 
Microorganisms go for fermentation process when they lack Electron t.pdf
Microorganisms go for fermentation process when they lack Electron t.pdfMicroorganisms go for fermentation process when they lack Electron t.pdf
Microorganisms go for fermentation process when they lack Electron t.pdf
anoopkhandelwal30
 
Answer A The financial executive in a small business is a key dec.pdf
Answer A The financial executive in a small business is a key dec.pdfAnswer A The financial executive in a small business is a key dec.pdf
Answer A The financial executive in a small business is a key dec.pdf
anoopkhandelwal30
 
I have been in college and I am very well aware of the things that I.pdf
I have been in college and I am very well aware of the things that I.pdfI have been in college and I am very well aware of the things that I.pdf
I have been in college and I am very well aware of the things that I.pdf
anoopkhandelwal30
 
compPcompA are two component systems for regulating response and ge.pdf
compPcompA are two component systems for regulating response and ge.pdfcompPcompA are two component systems for regulating response and ge.pdf
compPcompA are two component systems for regulating response and ge.pdf
anoopkhandelwal30
 
Autocrine signals affect only cells that are of the same cell type a.pdf
Autocrine signals affect only cells that are of the same cell type a.pdfAutocrine signals affect only cells that are of the same cell type a.pdf
Autocrine signals affect only cells that are of the same cell type a.pdf
anoopkhandelwal30
 
a) PEST A destructive insect or other animal that attacks crops, fo.pdf
a) PEST A destructive insect or other animal that attacks crops, fo.pdfa) PEST A destructive insect or other animal that attacks crops, fo.pdf
a) PEST A destructive insect or other animal that attacks crops, fo.pdf
anoopkhandelwal30
 

More from anoopkhandelwal30 (20)

molecular mass of NaF = 42gm thus, moles of NaF =.pdf
                     molecular mass of NaF = 42gm thus, moles of NaF =.pdf                     molecular mass of NaF = 42gm thus, moles of NaF =.pdf
molecular mass of NaF = 42gm thus, moles of NaF =.pdf
 
The organisms which have Electron transport chain, are able to conve.pdf
The organisms which have Electron transport chain, are able to conve.pdfThe organisms which have Electron transport chain, are able to conve.pdf
The organisms which have Electron transport chain, are able to conve.pdf
 
Intensity The amplitude of electromagnetic waves.pdf
                     Intensity  The amplitude of electromagnetic waves.pdf                     Intensity  The amplitude of electromagnetic waves.pdf
Intensity The amplitude of electromagnetic waves.pdf
 
The currently existing subphylums of the Phylum Arthropoda are, Ch.pdf
The currently existing subphylums of the Phylum Arthropoda are, Ch.pdfThe currently existing subphylums of the Phylum Arthropoda are, Ch.pdf
The currently existing subphylums of the Phylum Arthropoda are, Ch.pdf
 
The Austin Blind Salamander cannot see because of the adaptation to .pdf
The Austin Blind Salamander cannot see because of the adaptation to .pdfThe Austin Blind Salamander cannot see because of the adaptation to .pdf
The Austin Blind Salamander cannot see because of the adaptation to .pdf
 
I figured it out.... thanks anyway .pdf
                     I figured it out.... thanks anyway               .pdf                     I figured it out.... thanks anyway               .pdf
I figured it out.... thanks anyway .pdf
 
Phloem is transport element or vascular tissue of plants. Phloem tra.pdf
Phloem is transport element or vascular tissue of plants. Phloem tra.pdfPhloem is transport element or vascular tissue of plants. Phloem tra.pdf
Phloem is transport element or vascular tissue of plants. Phloem tra.pdf
 
New Haven is a city and a housing finance firm started in the city w.pdf
New Haven is a city and a housing finance firm started in the city w.pdfNew Haven is a city and a housing finance firm started in the city w.pdf
New Haven is a city and a housing finance firm started in the city w.pdf
 
Mean = sum of all values Total no. of values = 24.0Variance = [ .pdf
Mean = sum of all values  Total no. of values = 24.0Variance = [ .pdfMean = sum of all values  Total no. of values = 24.0Variance = [ .pdf
Mean = sum of all values Total no. of values = 24.0Variance = [ .pdf
 
Microorganisms go for fermentation process when they lack Electron t.pdf
Microorganisms go for fermentation process when they lack Electron t.pdfMicroorganisms go for fermentation process when they lack Electron t.pdf
Microorganisms go for fermentation process when they lack Electron t.pdf
 
can you provide a picture of that data we don.pdf
                     can you provide a picture of that data  we don.pdf                     can you provide a picture of that data  we don.pdf
can you provide a picture of that data we don.pdf
 
Answer A The financial executive in a small business is a key dec.pdf
Answer A The financial executive in a small business is a key dec.pdfAnswer A The financial executive in a small business is a key dec.pdf
Answer A The financial executive in a small business is a key dec.pdf
 
I have been in college and I am very well aware of the things that I.pdf
I have been in college and I am very well aware of the things that I.pdfI have been in college and I am very well aware of the things that I.pdf
I have been in college and I am very well aware of the things that I.pdf
 
False.Main reason is sediments around the delta.SolutionFals.pdf
False.Main reason is sediments around the delta.SolutionFals.pdfFalse.Main reason is sediments around the delta.SolutionFals.pdf
False.Main reason is sediments around the delta.SolutionFals.pdf
 
compPcompA are two component systems for regulating response and ge.pdf
compPcompA are two component systems for regulating response and ge.pdfcompPcompA are two component systems for regulating response and ge.pdf
compPcompA are two component systems for regulating response and ge.pdf
 
can you please repost the question...its not properly readable.pdf
can you please repost the question...its not properly readable.pdfcan you please repost the question...its not properly readable.pdf
can you please repost the question...its not properly readable.pdf
 
Contribution of atom at corners = 18 Contributio.pdf
                     Contribution of atom at corners = 18 Contributio.pdf                     Contribution of atom at corners = 18 Contributio.pdf
Contribution of atom at corners = 18 Contributio.pdf
 
Autocrine signals affect only cells that are of the same cell type a.pdf
Autocrine signals affect only cells that are of the same cell type a.pdfAutocrine signals affect only cells that are of the same cell type a.pdf
Autocrine signals affect only cells that are of the same cell type a.pdf
 
C and D are the answers. Solution .pdf
                     C and D are the answers.  Solution           .pdf                     C and D are the answers.  Solution           .pdf
C and D are the answers. Solution .pdf
 
a) PEST A destructive insect or other animal that attacks crops, fo.pdf
a) PEST A destructive insect or other animal that attacks crops, fo.pdfa) PEST A destructive insect or other animal that attacks crops, fo.pdf
a) PEST A destructive insect or other animal that attacks crops, fo.pdf
 

Recently uploaded

Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 

JPasswordA.javaimport javax.swing.; import java.awt.; imp.pdf

  • 1. // JPasswordA.java import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.Color; public class JPasswordA extends JApplet implements ActionListener { JLabel inputPassword = new JLabel("Input a password!"); Font firstFont = new Font("Arial", Font.ITALIC, 54); Font secondFOnt = new Font("Arial", Font.BOLD, 54); JTextField result = new JTextField(2); JButton Input = new JButton("Input"); JLabel checkGranted = new JLabel("Access Granted!"); JLabel checkDenied = new JLabel("Access Denied!"); Container containeeer = getContentPane(); public void init() { containeeer.setLayout(new FlowLayout()); inputPassword.setFont(firstFont); checkGranted.setFont(secondFOnt); checkDenied.setFont(secondFOnt); containeeer.add(inputPassword); containeeer.add(result); containeeer.add(Input); containeeer.setBackground(Color.RED); Input.addActionListener(this); result.addActionListener(this); } public void actionPerformed(ActionEvent e) { String userPassword = result.getText(); containeeer.remove(inputPassword); containeeer.remove(Input); containeeer.remove(result); if(userPassword.equals("Rosebud"))
  • 2. { containeeer.setBackground(Color.BLUE); containeeer.add(checkGranted); } else { containeeer.setBackground(Color.GREEN); containeeer.add(checkDenied); } validate(); } } //JPasswordB.java import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.Color; public class JPasswordB extends JApplet implements ActionListener { JLabel inputPassword = new JLabel("input a password!"); Font firstFont = new Font("Arial", Font.BOLD, 54); Font sencondFont = new Font("Arial", Font.BOLD, 54); JTextField result = new JTextField(20); JButton input = new JButton("input"); JLabel checkGranted = new JLabel("Access Granted!"); JLabel checkDenied = new JLabel("Access Denied!"); Container containeeer = getContentPane(); public void init() { containeeer.setLayout(new FlowLayout()); inputPassword.setFont(firstFont); checkGranted.setFont(sencondFont); checkDenied.setFont(sencondFont); containeeer.add(inputPassword); containeeer.add(result); containeeer.add(input);
  • 3. containeeer.setBackground(Color.RED); input.addActionListener(this); result.addActionListener(this); } public void actionPerformed(ActionEvent e) { String userPassword = result.getText(); containeeer.remove(inputPassword); containeeer.remove(input); containeeer.remove(result); if(userPassword.equalsIgnoreCase("Rosebud")) { containeeer.setBackground(Color.BLUE); containeeer.add(checkGranted); } else { containeeer.setBackground(Color.GREEN); containeeer.add(denied); } validate(); } } // JPasswordC.java import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.Color; public class JPasswordC extends JApplet implements ActionListener { JLabel inputPassword = new JLabel("Please enter a password!"); Font firstFont = new Font("Arial", Font.ITALIC, 34); Font sencondFont = new Font("Arial", Font.BOLD, 46); JTextField result = new JTextField(10); JButton enter = new JButton("Enter"); JLabel checkGranted = new JLabel("Access Granted!");
  • 4. JLabel checkDenied = new JLabel("Access Denied!"); Container containeeer = getContentPane(); public void init() { containeeer.setLayout(new FlowLayout()); inputPassword.setFont(firstFont); checkGranted.setFont(sencondFont); checkDenied.setFont(sencondFont); containeeer.add(inputPassword); containeeer.add(result); containeeer.add(enter); containeeer.setBackground(Color.RED); enter.addActionListener(this); result.addActionListener(this); } public void actionPerformed(ActionEvent e) { String userPassword = result.getText(); containeeer.remove(inputPassword); containeeer.remove(enter); containeeer.remove(result); if(userPassword.equalsIgnoreCase("Rosebud")|| userPassword.equalsIgnoreCase("Redrum")|| userPassword.equalsIgnoreCase("Jason")|| userPassword.equalsIgnoreCase("Surrender")|| userPassword.equalsIgnoreCase("Dorothy")) { containeeer.setBackground(Color.BLUE); containeeer.add(checkGranted); } else { containeeer.setBackground(Color.GREEN); containeeer.add(checkDenied); } validate(); } }
  • 5. Solution // JPasswordA.java import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.Color; public class JPasswordA extends JApplet implements ActionListener { JLabel inputPassword = new JLabel("Input a password!"); Font firstFont = new Font("Arial", Font.ITALIC, 54); Font secondFOnt = new Font("Arial", Font.BOLD, 54); JTextField result = new JTextField(2); JButton Input = new JButton("Input"); JLabel checkGranted = new JLabel("Access Granted!"); JLabel checkDenied = new JLabel("Access Denied!"); Container containeeer = getContentPane(); public void init() { containeeer.setLayout(new FlowLayout()); inputPassword.setFont(firstFont); checkGranted.setFont(secondFOnt); checkDenied.setFont(secondFOnt); containeeer.add(inputPassword); containeeer.add(result); containeeer.add(Input); containeeer.setBackground(Color.RED); Input.addActionListener(this); result.addActionListener(this); } public void actionPerformed(ActionEvent e) { String userPassword = result.getText(); containeeer.remove(inputPassword); containeeer.remove(Input);
  • 6. containeeer.remove(result); if(userPassword.equals("Rosebud")) { containeeer.setBackground(Color.BLUE); containeeer.add(checkGranted); } else { containeeer.setBackground(Color.GREEN); containeeer.add(checkDenied); } validate(); } } //JPasswordB.java import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.Color; public class JPasswordB extends JApplet implements ActionListener { JLabel inputPassword = new JLabel("input a password!"); Font firstFont = new Font("Arial", Font.BOLD, 54); Font sencondFont = new Font("Arial", Font.BOLD, 54); JTextField result = new JTextField(20); JButton input = new JButton("input"); JLabel checkGranted = new JLabel("Access Granted!"); JLabel checkDenied = new JLabel("Access Denied!"); Container containeeer = getContentPane(); public void init() { containeeer.setLayout(new FlowLayout()); inputPassword.setFont(firstFont); checkGranted.setFont(sencondFont); checkDenied.setFont(sencondFont); containeeer.add(inputPassword);
  • 7. containeeer.add(result); containeeer.add(input); containeeer.setBackground(Color.RED); input.addActionListener(this); result.addActionListener(this); } public void actionPerformed(ActionEvent e) { String userPassword = result.getText(); containeeer.remove(inputPassword); containeeer.remove(input); containeeer.remove(result); if(userPassword.equalsIgnoreCase("Rosebud")) { containeeer.setBackground(Color.BLUE); containeeer.add(checkGranted); } else { containeeer.setBackground(Color.GREEN); containeeer.add(denied); } validate(); } } // JPasswordC.java import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.Color; public class JPasswordC extends JApplet implements ActionListener { JLabel inputPassword = new JLabel("Please enter a password!"); Font firstFont = new Font("Arial", Font.ITALIC, 34); Font sencondFont = new Font("Arial", Font.BOLD, 46); JTextField result = new JTextField(10);
  • 8. JButton enter = new JButton("Enter"); JLabel checkGranted = new JLabel("Access Granted!"); JLabel checkDenied = new JLabel("Access Denied!"); Container containeeer = getContentPane(); public void init() { containeeer.setLayout(new FlowLayout()); inputPassword.setFont(firstFont); checkGranted.setFont(sencondFont); checkDenied.setFont(sencondFont); containeeer.add(inputPassword); containeeer.add(result); containeeer.add(enter); containeeer.setBackground(Color.RED); enter.addActionListener(this); result.addActionListener(this); } public void actionPerformed(ActionEvent e) { String userPassword = result.getText(); containeeer.remove(inputPassword); containeeer.remove(enter); containeeer.remove(result); if(userPassword.equalsIgnoreCase("Rosebud")|| userPassword.equalsIgnoreCase("Redrum")|| userPassword.equalsIgnoreCase("Jason")|| userPassword.equalsIgnoreCase("Surrender")|| userPassword.equalsIgnoreCase("Dorothy")) { containeeer.setBackground(Color.BLUE); containeeer.add(checkGranted); } else { containeeer.setBackground(Color.GREEN); containeeer.add(checkDenied); } validate();
  • 9. } }