?
Solved

Errors now in program need help!

Posted on 2004-04-17
8
Medium Priority
?
277 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 2000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

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…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

719 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