SlideShare a Scribd company logo
// 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

PDF
Program-a. library is importedimport java.awt.; import j.pdf
TXT
Class login
DOCX
Library management system
PDF
PasswordCheckerGUI.javaimport javafx.application.Application; im.pdf
PDF
ANSimport java.awt.event.;import javax.swing.; import java..pdf
PDF
correct the error import javaxswingJFrame import javaxs.pdf
PDF
Tugas Praktikum Java 2
PDF
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
Program-a. library is importedimport java.awt.; import j.pdf
Class login
Library management system
PasswordCheckerGUI.javaimport javafx.application.Application; im.pdf
ANSimport java.awt.event.;import javax.swing.; import java..pdf
correct the error import javaxswingJFrame import javaxs.pdf
Tugas Praktikum Java 2
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf

More from anoopkhandelwal30 (20)

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

Recently uploaded (20)

PPTX
Cell Structure & Organelles in detailed.
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Complications of Minimal Access Surgery at WLH
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
Updated Idioms and Phrasal Verbs in English subject
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Cell Structure & Organelles in detailed.
Final Presentation General Medicine 03-08-2024.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Complications of Minimal Access Surgery at WLH
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Supply Chain Operations Speaking Notes -ICLT Program
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
Final Presentation General Medicine 03-08-2024.pptx
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Practical Manual AGRO-233 Principles and Practices of Natural Farming
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Updated Idioms and Phrasal Verbs in English subject
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Weekly quiz Compilation Jan -July 25.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx

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. } }