eugene007
asked on
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
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
ASKER
java.lang.NullPointerExcep tion
at HospitalGUI.actionPerforme d(Hospital GUI.java:2 33)
at javax.swing.AbstractButton .fireActio nPerformed (AbstractB utton.java :17
86)
at javax.swing.AbstractButton $ForwardAc tionEvents .actionPer formed(Abs tra
ctButton.java:1839)
at javax.swing.DefaultButtonM odel.fireA ctionPerfo rmed(Defau ltButtonMo del
.java:420)
at javax.swing.DefaultButtonM odel.setPr essed(Defa ultButtonM odel.java: 258
)
at javax.swing.plaf.basic.Bas icButtonLi stener.mou seReleased (BasicButt onL
istener.java:245)
at java.awt.Component.process MouseEvent (Component .java:5100 )
at java.awt.Component.process Event(Comp onent.java :4897)
at java.awt.Container.process Event(Cont ainer.java :1569)
at java.awt.Component.dispatc hEventImpl (Component .java:3615 )
at java.awt.Container.dispatc hEventImpl (Container .java:1627 )
at java.awt.Component.dispatc hEvent(Com ponent.jav a:3477)
at java.awt.LightweightDispat cher.retar getMouseEv ent(Contai ner.java:3 483
)
at java.awt.LightweightDispat cher.proce ssMouseEve nt(Contain er.java:31 98)
at java.awt.LightweightDispat cher.dispa tchEvent(C ontainer.j ava:3128)
at java.awt.Container.dispatc hEventImpl (Container .java:1613 )
at java.awt.Window.dispatchEv entImpl(Wi ndow.java: 1606)
at java.awt.Component.dispatc hEvent(Com ponent.jav a:3477)
at java.awt.EventQueue.dispat chEvent(Ev entQueue.j ava:456)
at java.awt.EventDispatchThre ad.pumpOne EventForHi erarchy(Ev entDispatc hTh
read.java:201)
at java.awt.EventDispatchThre ad.pumpEve ntsForHier archy(Even tDispatchT hre
ad.java:151)
at java.awt.EventDispatchThre ad.pumpEve nts(EventD ispatchThr ead.java:1 45)
at java.awt.EventDispatchThre ad.pumpEve nts(EventD ispatchThr ead.java:1 37)
at java.awt.EventDispatchThre ad.run(Eve ntDispatch Thread.jav a:100)
at HospitalGUI.actionPerforme
at javax.swing.AbstractButton
86)
at javax.swing.AbstractButton
ctButton.java:1839)
at javax.swing.DefaultButtonM
.java:420)
at javax.swing.DefaultButtonM
)
at javax.swing.plaf.basic.Bas
istener.java:245)
at java.awt.Component.process
at java.awt.Component.process
at java.awt.Container.process
at java.awt.Component.dispatc
at java.awt.Container.dispatc
at java.awt.Component.dispatc
at java.awt.LightweightDispat
)
at java.awt.LightweightDispat
at java.awt.LightweightDispat
at java.awt.Container.dispatc
at java.awt.Window.dispatchEv
at java.awt.Component.dispatc
at java.awt.EventQueue.dispat
at java.awt.EventDispatchThre
read.java:201)
at java.awt.EventDispatchThre
ad.java:151)
at java.awt.EventDispatchThre
at java.awt.EventDispatchThre
at java.awt.EventDispatchThre
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
if(p.getName().equalsIgnor eCase(mf.g etName()))
{
equality = true;
}
{
equality = true;
}
One of those objects (4 of them) is null
Actually it's 3 of them (read them left to right)
(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)
ASKER
if(p!=null)
{
if(p.getName().equalsIgnor eCase(mf.g etName()))
{
equality = true;
}
}
That solves the problem, as u have mentioned. I surely have to learn to trace the error, by looking at my console.
{
if(p.getName().equalsIgnor
{
equality = true;
}
}
That solves the problem, as u have mentioned. I surely have to learn to trace the error, by looking at my console.
Yep. You *have* learned already now ;-)
:-)
ASKER
I better start sleeping early, and wake up early, before posting questions to EE.
That's not helpful. Please say what errors and post the stack trace