Solved

Errors now in program need help!

Posted on 2004-04-17
8
274 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
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.

 
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

615 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