?
Solved

deleting

Posted on 2005-05-16
11
Medium Priority
?
164 Views
Last Modified: 2010-03-31
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
0
Comment
Question by:eugene007
  • 7
  • 4
11 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 14012617
>>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
 

Author Comment

by:eugene007
ID: 14012639
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
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 14012670
And what is the line:

>>HospitalGUI.java:233

?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:eugene007
ID: 14012688
if(p.getName().equalsIgnoreCase(mf.getName()))
{
     equality = true;
}
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 14012710
One of those objects (4 of them) is null
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 14012729
Actually it's 3 of them (read them left to right)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 14012746
(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
 

Author Comment

by:eugene007
ID: 14012762
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 14012834
Yep. You *have* learned already now ;-)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 14017008
:-)
0
 

Author Comment

by:eugene007
ID: 14026357
I better start sleeping early, and wake up early, before posting questions to EE.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month14 days, 16 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question