Solved

Errors now in program need help!

Posted on 2004-04-17
8
272 Views
Last Modified: 2010-03-31
I now get these errors the trying to run the code you hlep with.

JAVA
 SDK...

C:\Documents and Settings\Glyn Jackson\Desktop\Doctors Surgery 2004>set PATH=c:\
j2sdk1.4.1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem

C:\Documents and Settings\Glyn Jackson\Desktop\Doctors Surgery 2004>javac AppInt
erface.java
.\assignDoctor.java:4: package net.proteanit.util does not exist
import net.proteanit.util.PersistentStringList;
                          ^
.\assignDoctor.java:5: package net.proteanit.util does not exist
import net.proteanit.util.StringList;
                          ^
.\AppButtonInterface.java:148: main(java.lang.String[]) in assignDoctor cannot b
e applied to ()
   e.main();
    ^
.\assignDoctor.java:28: cannot resolve symbol
symbol  : variable patientFile
location: class assignDoctor
    patientFile = new PersistentStringList(strFile);
    ^
.\assignDoctor.java:28: cannot resolve symbol
symbol  : class PersistentStringList
location: class assignDoctor
    patientFile = new PersistentStringList(strFile);
                      ^
5 errors




//down below is the code for assignDoctor class. -------------------------------------------

import javax.swing.*;
import java.io.*;
import net.proteanit.util.PersistentStringList;
import net.proteanit.util.StringList;


public class assignDoctor {
 // private PersistentStringList patientFile;


  public static void main(String[] args) {
    System.out.println("testtststststts");
    assignDoctor ad = new assignDoctor();
    ad.findPatientRecord();
  }


  public boolean findPatientRecord() {
    String strFile = String.valueOf(JOptionPane.showInputDialog(null,
        "Please Enter ID to Search For?", "System Search Question",
        JOptionPane.ERROR_MESSAGE, null, null, "1"));
    System.out.println(strFile);
    File f = new File(strFile);
    if (f.exists()) {
      JOptionPane.showMessageDialog(null, "File Was Found", "System Message: Record Found!", JOptionPane.INFORMATION_MESSAGE);
      // Open the record
    patientFile = new PersistentStringList(strFile);
      return true;
    }
    else {
      JOptionPane.showMessageDialog(null, "There is no Record with that ID!", "System Message", JOptionPane.ERROR_MESSAGE);
      return false;
    }
  }
}










//here is the code for the other call which is generating 1 of the errors also


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class AppButtonInterface extends JFrame {
   private JButton PatientButton, PrintButton, PrintDoctorButon, AssignDoctor, DoctorButton, ExitButton, RemoveButton, RemoveDoctor;

   // set up GUI
   public AppButtonInterface()
   {
      super( "Welcome to Doctors Surgery 2004 v1" );

      // get content pane and set its layout
      Container container = getContentPane();
      container.setLayout( new FlowLayout() );

      // create buttons------------------------------
      PatientButton = new JButton( "Add Patient" );
      container.add( PatientButton );

      PrintButton = new JButton( "Print Patient File" );
      container.add( PrintButton );

      RemoveButton = new JButton( "Remove Patient File" );
      container.add( RemoveButton );

      DoctorButton = new JButton( "Add Doctor" );
      container.add( DoctorButton );

      PrintDoctorButon = new JButton( "Print Doctor File" );
      container.add( PrintDoctorButon );

      RemoveDoctor = new JButton( "Remove Doctor File" );
      container.add( RemoveDoctor );

      AssignDoctor = new JButton( "Assign Patient With Doctor" );
      container.add( AssignDoctor );

      ExitButton = new JButton( "Exit System" );
      container.add( ExitButton );


      // create buttons------------------------------


      // create an instance of inner class ButtonHandler
      // to use for button event handling
      ButtonHandler handler = new ButtonHandler();
      ExitButton.addActionListener( handler );
      PatientButton.addActionListener( handler );
      PrintButton.addActionListener( handler );
      DoctorButton.addActionListener( handler );
      RemoveButton.addActionListener( handler );
      RemoveDoctor.addActionListener( handler );
      PrintDoctorButon.addActionListener( handler );
      AssignDoctor.addActionListener( handler );

      setSize( 400, 200 );
      setVisible( true );

   } // end ButtonTest constructor

   public static void main( String args[] )
   {
      AppButtonInterface application = new AppButtonInterface();
      application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );

   }

   // inner class for button event handling
   private class ButtonHandler implements ActionListener {

     //HANDLE BUTTON EVENTS
      public void actionPerformed( ActionEvent event )
      {


        // CREATE OBJECT READY TO CALL FROM CLASS
        SystemMessages a = new SystemMessages();
        getPatient b = new getPatient();
        getDoctor c = new getDoctor();



        //EXIT BUTTON EVENT!
        if (event.getActionCommand() == "Exit System")
        {
          //LOAD FROM SYSTEM MESSAGE
          a.exitsystem();
          //EXIT PROGRAM
          System.exit(0);
        }

        else if (event.getActionCommand() == "Add Patient")
        {
            a.loading();
            b.getnewPatient();

        }

        else if (event.getActionCommand() == "Print Patient File")
       {
         a.loading();
         b.PrintPatient();


       }

       else if (event.getActionCommand() == "Remove Patient File")
       {
         a.loading();
         b.RemovePatient();


       }

       else if (event.getActionCommand() == "Add Doctor")
     {
       a.loading();
       c.doctor();


     }

     else if (event.getActionCommand() == "Remove Doctor File")
    {
      a.loading();
      c.RemoveDoctor();


    }

    else if (event.getActionCommand() == "Print Doctor File")
    {
      a.loading();
      c.PrintDoctor();


     }


     else if (event.getActionCommand() == "Assign Patient With Doctor")
     {
   a.loading();
   assignDoctor e = new assignDoctor();
   e.main();

//this is where 1 of the errors is!!!!!!!


     }


      }

   } // end private inner class ButtonHandler

} // end class ButtonTest
0
Comment
Question by:pigmentarts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 10850366
>>import net.proteanit.util.PersistentStringList;

If you look at the code i originally gave you, i said to remove these package declarations
0
 
LVL 12

Author Comment

by:pigmentarts
ID: 10850570
when i did that the line:

 patientFile = new PersistentStringList(strFile);

has an error?
0
 
LVL 92

Expert Comment

by:objects
ID: 10851114
import javax.swing.*;
import java.io.*;

public class assignDoctor {


  public static void main(String[] args) {
    System.out.println("testtststststts");
    assignDoctor ad = new assignDoctor();
    ad.findPatientRecord();
  }


  public boolean findPatientRecord() {
    String strFile = String.valueOf(JOptionPane.showInputDialog(null,
        "Please Enter ID to Search For?", "System Search Question",
        JOptionPane.ERROR_MESSAGE, null, null, "1"));
    System.out.println(strFile);
    File f = new File(strFile);
    if (f.exists()) {
      JOptionPane.showMessageDialog(null, "File Was Found", "System Message: Record Found!", JOptionPane.INFORMATION_MESSAGE);
      return true;
    }
    else {
      JOptionPane.showMessageDialog(null, "There is no Record with that ID!", "System Message", JOptionPane.ERROR_MESSAGE);
      return false;
    }
  }
}
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 92

Expert Comment

by:objects
ID: 10851118
  else if (event.getActionCommand() == "Assign Patient With Doctor")
     {
   a.loading();
   assignDoctor e = new assignDoctor();
   e.main(null);
}

0
 
LVL 92

Expert Comment

by:objects
ID: 10851123
thats last bit would be better written as the foillowing though:

   else if (event.getActionCommand().equals("Assign Patient With Doctor")
   {
   a.loading();
   assignDoctor e = new assignDoctor();
   e.findPatientRecord();
   }
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 10851130
> else if (event.getActionCommand() == "Assign Patient With Doctor")

and all those tests should use equals method instead of ==

else if (event.getActionCommand().equals("Assign Patient With Doctor"))
0
 
LVL 12

Author Comment

by:pigmentarts
ID: 10853868
i did not know that why is .equals different then == , and thanks for your help!
0
 
LVL 92

Expert Comment

by:objects
ID: 10855559
== tests for object equality, where the String's equals method tests for string equality.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
hibernate example using maven 12 113
Java: anonymous class 4 55
junit example issue 2 59
Eclipse neon2 "Java build path" correctness 7 44
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Suggested Courses

710 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