Hello everyone,
Im new to this forum and sort of new to Java aswell. I'd like to ask you to comment on the way I practise Java and also hopefully solve this "Start: Applet not initialized." error. I have not tried to run this through browsers because i didn't create the html yet but i am using an applet viewer instead.
At this step i am only attempting to do the layout of the log in screen of the program and nothing is happening behind the curtain. and other than the error i get on the applet viewer Start: Applet not initialized."
i also get the following code at the compiler after attempting to run the applet
java.lang.NullPointerException
at Window.init(Window.java:34)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.GridLayout;
import javax.swing.*;
//import javax.swing.JApplet;
//import javax.swing.JButton;
//import javax.swing.JLabel;
//import javax.swing.JPanel;
//import javax.swing.JPasswordField;
//import javax.swing.JTextField;
public class Window extends JApplet{
private Container windowC;
private JPanel logInPan, bannerPan, cpPan, bottomPan, logMidPan;
private JTextField inName = new JTextField(15);
private JPasswordField inPass = new JPasswordField();
private JButton loginB = new JButton("Log In");
private JButton signUpB = new JButton("Sign Up");
private JButton forgotB = new JButton("Forgot your Password?");
private JLabel welcomeL = new JLabel("Welcome to Firm 5 System");
private JLabel infoL = new JLabel("Please Enter your details to access your account.");
private JLabel nameL = new JLabel("UserName");
private JLabel passL = new JLabel("Password");
public void init(){
windowC = getContentPane();
GridLayout mainLay = new GridLayout(2,1);
GridLayout bottomLay = new GridLayout(1,2);
windowC.setLayout(mainLay);
bottomPan.setLayout(bottomLay);
logInPan.setLayout(new GridLayout(4,1));
logMidPan.setLayout(new GridLayout(3,2));
logMidPan.add(nameL);
logMidPan.add(inName);
logMidPan.add(passL);
logMidPan.add(inPass);
logMidPan.add(loginB);
logMidPan.add(signUpB);
logInPan.add(welcomeL, BorderLayout.NORTH);
logInPan.add(infoL);
logInPan.add(logMidPan, BorderLayout.CENTER);
logInPan.add(forgotB, BorderLayout.SOUTH);
windowC.add(bannerPan);
bottomPan.add(cpPan);
bottomPan.add(logInPan);
windowC.add(bottomPan);
windowC.setSize(1024, 768);
windowC.setVisible(true);
}
}
I'd be grateful with any constructive critism which can help me improve and grateful x2 for helping me find out why this error is happening