deleting

In my HospitalGUI.java I have the foolowing code:

if(ae.getSource()==deleMF)
{
    //codes
}

The codes in the if clause is suppose to delete the Medical Facility along with its procedures.

I also have the functionality of saving and loading in my HospitalGUI.java.

It seems that when ever I load the patients and the medical facility and the procedures, and then I try to delete the medical facility I get errors.

However when I dont load the objects, but add the procedures and etc, and then try to delete the medical facility it works fine.

You can download the program from:

www.mutaiyas.com/db/GUI.zip

along with the download I have included a .txt file, which you would be able to load from the GUI.

How do I solve this problem?.

Your help is kindly appreciated.

Regards

Eugene
eugene007Asked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
And what is the line:

>>HospitalGUI.java:233

?
0
 
CEHJCommented:
>>and then I try to delete the medical facility I get errors.

That's not helpful. Please say what errors and post the stack trace
0
 
eugene007Author Commented:
java.lang.NullPointerException
        at HospitalGUI.actionPerformed(HospitalGUI.java:233)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
86)
        at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
ctButton.java:1839)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:420)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:245)
        at java.awt.Component.processMouseEvent(Component.java:5100)
        at java.awt.Component.processEvent(Component.java:4897)
        at java.awt.Container.processEvent(Container.java:1569)
        at java.awt.Component.dispatchEventImpl(Component.java:3615)
        at java.awt.Container.dispatchEventImpl(Container.java:1627)
        at java.awt.Component.dispatchEvent(Component.java:3477)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483
)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)

        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
        at java.awt.Container.dispatchEventImpl(Container.java:1613)
        at java.awt.Window.dispatchEventImpl(Window.java:1606)
        at java.awt.Component.dispatchEvent(Component.java:3477)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:201)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:151)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
eugene007Author Commented:
if(p.getName().equalsIgnoreCase(mf.getName()))
{
     equality = true;
}
0
 
CEHJCommented:
One of those objects (4 of them) is null
0
 
CEHJCommented:
Actually it's 3 of them (read them left to right)
0
 
CEHJCommented:
(Meaning that mf.getName() could return null without a problem) So it's one or more of the first three (although only one of them will have caused the exception to be thrown)
0
 
eugene007Author Commented:
if(p!=null)
{                      
    if(p.getName().equalsIgnoreCase(mf.getName()))
    {
              equality = true;
    }
}

That solves the problem, as u have mentioned. I surely have to learn to trace the error, by looking at my console.      
0
 
CEHJCommented:
Yep. You *have* learned already now ;-)
0
 
CEHJCommented:
:-)
0
 
eugene007Author Commented:
I better start sleeping early, and wake up early, before posting questions to EE.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.