//import these following classesclasses import javax.swing.*; import java.awt.*; public class LoginCheckApplet extends JApplet /* creates a public class called LoginCheckApplet which (extends) "works in" Java Applet */ { // opens the class of Login CheckApplet // creates two variables of type string String username = " "; String password = " "; //creates of varianble of type Boolean - to be shared with LoginCheck boolean authorize; public void init () { /* gathers input from user by using JOptionPane.showInputDialog method. When the user inputs the username and password - they will each, respectively, then have the value given by user*/ username = JOptionPane.showInputDialog ("Please input user name:"); password = JOptionPane.showInputDialog ("Please input password:"); LoginCheck myLoginCheck = null; /*tells the public void init method to look to LoginCheck class for further instructions on what to do. Also assigns the LoginCheck the value of myLoginCheck which is initially set as null*/ myLoginCheck = new LoginCheck (username, password); /* not really sure what this does */ /* action based on value is returned from class, and then if true returned from the class*/ if (myLoginCheck.getAuthorize () == true) javax.swing.JOptionPane.showMessageDialog (null, "You were right!"); if (myLoginCheck.getAuthorize () != true) javax.swing.JOptionPane.showMessageDialog (null, "Sorry! \nPlease enter correct username and password!"); // end }// closes method of init /* this writes the following message to the Applet window, so the user knows what was input */ public void paint (Graphics g)/* creates a new method public void (Graphics g) which allows graphics/text to be printed in the Applet window */ { g.drawString ("The username you entered was " + username, 50, 30); g.drawString ("The password you entered was " + password, 50, 50); }//closes method public void paint }// closes the class