Hello, sorry about all the questions - I have checked google but have unfortunetly been unable to find a solution.
I have the following code
EmployeeManager class
public class EmployeeManager{
public static void main(String[] args){
TheManager manager = new TheManager();
}
}
TheManager class
public class TheManager{
protected MainFrame app;
private LoginPanel loginScreen;
private MainScreenPanel mainScreen;
public TheManager(){
MainFrame app = new MainFrame("Employee Manager");
loginScreen = new LoginPanel();
mainScreen = new MainScreenPanel();
app.add(loginScreen);
app.setVisible(true);
run();
}
public void run(){
//while(true){
if (app==null){
System.out.println("App is null");
}
else{
System.out.println("App isn't null");
}
//}
//app.add(mainScreen);
//app.remove(loginScreen);
//app.validate();
}
}
Was having a problem where it kept crashing saying NullPointerException on the now commented out app.add(mainScreen). Do a test to see if the app was null and it was.
Basically I want TheManager to eventually check the app for different states so if app.isLoggedIn() then display the mainScreen (which is a JPanel). P.S MainFrame extends JFrame
Thanks once again for any help thrown my way, you don't need to give me a complete fix, to be hoenst I think I'm going about this solution in the wrong way and its illegal to use JFrames the way I am doing.
Thanks!
[Edited by - natebuckley on September 18, 2008 5:00:37 AM]