hello cecily.
here is the exception and the rest of the code.
----jGRASP exec: java HomeEntertainment
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at User.doLogOn(LogOn.java:71)
at LogOn$1.actionPerformed(LogOn.java:42)
at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)
at javax.swing.AbstractButton$Handler.actionPerformed (Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(U nknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierar chy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
----jGRASP: process aborted by user.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class AdminMainMenu extends JFrame{
JPanel pnlBody;
JButton btnOrderSystem = new JButton("Order System");
JButton btnMaintenance = new JButton("Maintenance");
JButton btnAdminLogOff = new JButton("Log Off");
Container contentpane;
public AdminMainMenu(){
super("Main Menu");
contentpane = getContentPane();
contentpane.setLayout(new BorderLayout());
pnlBody = new JPanel();
pnlBody.add(btnOrderSystem);
pnlBody.add(btnMaintenance);
pnlBody.add(btnAdminLogOff);
contentpane.add(pnlBody,BorderLayout.CENTER);
pack();
setVisible(true);
btnOrderSystem.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
setVisible(false);
//OrderSystem os = new OrderSystem();
//os.setVisible(true);
}
});
btnMaintenance.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
setVisible(false);
//Maintenance m = new Maintenance();
//m.setVisible(true);
}
});
btnAdminLogOff.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
int result;
result = JOptionPane.showConfirmDialog(null, "Are you sure you want to log off?", null, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if(result == JOptionPane.YES_OPTION){
setVisible(false);
}
}
});
}
}
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class UserMainMenu extends JFrame{
JPanel pnlBody;
JButton btnUserProductMenu = new JButton("Product Menu");
JButton btnUserMemberMenu = new JButton("Member Menu");
JButton btnUserRentalMenu = new JButton("Rental Menu");
JButton btnUserLogOff = new JButton("Log Off");
Container contentpane;
public UserMainMenu(){
super("Main Menu");
contentpane = getContentPane();
contentpane.setLayout(new BorderLayout());
pnlBody = new JPanel();
pnlBody.add(btnUserProductMenu);
pnlBody.add(btnUserMemberMenu);
pnlBody.add(btnUserRentalMenu);
pnlBody.add(btnUserLogOff);
contentpane.add(pnlBody,BorderLayout.CENTER);
pack();
setVisible(true);
btnUserProductMenu.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
setVisible(false);
//UserProductMenu upm = new UserProductMenu();
//upm.setVisible(true);
}
});
btnUserMemberMenu.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
setVisible(false);
//UserMemberMenu umm = new UserMemberMenu();
//umm.setVisible(true);
}
});
btnUserRentalMenu.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
setVisible(false);
//UserRentalMenu urm = new UserRentalMenu();
//urm.setVisible(true);
}
});
btnUserLogOff.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
int result;
result = JOptionPane.showConfirmDialog(null, "Are you sure you want to log off?", null, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if(result == JOptionPane.YES_OPTION){
setVisible(false);
}
}
});
}
}