Please help Debug my System

Hello.

I need help with my System, it's giving me a number of Exception errors. Please help where possible

//This is the main screen of the Clerk

import javax.swing.*;

import java.awt.event.*;

import java.awt.*;

public class ThirdScreen extends JFrame implements ActionListener

{

public static JButton add,back,exit,search,update,delete;

private BackButtonHandler BackHandler;

private SearchButtonHandler SearchHandler;

private AddButtonHandler AddHandler;

private ExitButtonHandler ExitHandler;

private deleteButtonHandler deleteHandler;

private UpdateButtonHandler UpdateHandler;

private ImageIcon icon = new ImageIcon("doctors5.jpg");

private JLabel label = new JLabel();

private ImageIcon ic = new ImageIcon("doctors6.jpg");

private JLabel lab = new JLabel();

private ImageIcon ico = new ImageIcon("doctors3.jpg");

private JLabel labe = new JLabel();

private JMenuBar menuMB = new JMenuBar();

private JMenu file,edit;

private JMenuItem help,x,addE,updateE,searchE,deleteE,staff;

private JLabel le;

//start

public ThirdScreen() throws Exception

{

Container see = getContentPane();

see.setLayout(null);

see.setBackground(Color.white);

label.setIcon(icon);

lab.setIcon(ic);

labe.setIcon(ico);

add = new JButton("ADD");

search = new JButton("SEARCH");

update = new JButton("UPDATE");

delete = new JButton("DELETE");

back = new JButton("<<<BACK");

exit = new JButton("EXIT");

le = new JLabel("Lethabong Hospital");

add.setSize(200,80);

update.setSize(200,80);

delete.setSize(200,80);

back.setSize(200,50);

exit.setSize(200,50);

search.setSize(200,80);

le.setSize(200,30);

label.setSize(300,200);

lab.setSize(410,307);

labe.setSize(270,261);

add.setLocation(700,50);

search.setLocation(700,150);

update.setLocation(700,250);

delete.setLocation(700,350);

back.setLocation(700,450);

exit.setLocation(700,550);

le.setLocation(900,650);

label.setLocation(100,50);

lab.setLocation(100,300);

labe.setLocation(100,300);

see.add(add);

see.add(back);

see.add(search);

see.add(update);

see.add(delete);

see.add(exit);

see.add(le);

see.add(label);

see.add(lab);

see.add(label);

//see.add(labe);

BackHandler = new BackButtonHandler(this);

SearchHandler = new SearchButtonHandler(this);

AddHandler = new AddButtonHandler(this);

ExitHandler = new ExitButtonHandler();

deleteHandler = new deleteButtonHandler(this);

UpdateHandler = new UpdateButtonHandler(this);

back.addActionListener(BackHandler);

add.addActionListener(AddHandler);

delete.addActionListener(deleteHandler);

update.addActionListener(UpdateHandler);

exit.addActionListener(ExitHandler);

search.addActionListener(SearchHandler);

setJMenuBar(menuMB);

setFileMenu();

setEditMenu();

setTitle("CHOOSE.....");

setSize(1023,750);

setVisible(true);

setDefaultCloseOperation(EXIT_ON_CLOSE);

}//end of constructor

//start of Backbuttonhandler

private class BackButtonHandler implements ActionListener

{

private JFrame fr;

public BackButtonHandler(JFrame frame)

{

fr = frame;

}

public void actionPerformed (ActionEvent g)

{

SecondScreen fram = new SecondScreen();

fr.hide();

}

}//end of backbuttonhandler

//start of BackButtonhandler

private class SearchButtonHandler implements ActionListener

{

private JFrame fr;

public SearchButtonHandler(JFrame frame)

{

fr = frame;

}

public void actionPerformed (ActionEvent o)

{

new SearchScreen();

fr.hide();

}

}//end of backbuttonhandler

//This is used to set the text

//exit method

private class ExitButtonHandler implements ActionListener

{

public void actionPerformed (ActionEvent s)

{

System.exit(0);

}

}//end of exit method

//start of add button

private class AddButtonHandler implements ActionListener

{

private JFrame fr;

public AddButtonHandler(JFrame frame)

{

fr = frame;

}

public void actionPerformed (ActionEvent j)

{

FourthScreen frame = new FourthScreen();

fr.hide();

}

}

//ehd off add button

//start of update button when clicked

private class UpdateButtonHandler implements ActionListener

{

private JFrame fr;

public UpdateButtonHandler(JFrame frame)

{

fr = frame;

}

public void actionPerformed (ActionEvent o)

{

new Dating();

fr.hide();

}

}//end of update button

//start of deletebutton

private class deleteButtonHandler implements ActionListener

{

private JFrame fr;

public deleteButtonHandler(JFrame frame)

{

fr = frame;

}

public void actionPerformed (ActionEvent j)

{

new DeleteScreen();

fr.hide();

}

}//end of delete

//This is for the menu

private void setFileMenu()

{

file = new JMenu("File");

menuMB.add(file);

help = new JMenuItem("Help");

file.add(help);

x = new JMenuItem("Close");

file.add(x);

x.addActionListener(this);

help.addActionListener(this);

}

//end of setFileMenu

//start of editmenu

private void setEditMenu()

{

edit = new JMenu("Edit");

menuMB.add(edit);

addE = new JMenuItem("Add Patients");

edit.add(addE);

updateE = new JMenuItem("Update Patients");

edit.add(updateE);

deleteE = new JMenuItem("Delete Patients");

edit.add(deleteE);

searchE = new JMenuItem("Search Patients");

edit.add(searchE);

staff = new JMenuItem("New Staff");

edit.add(staff);

addE.addActionListener(this);

staff.addActionListener(this);

updateE.addActionListener(this);

deleteE.addActionListener(this);

searchE.addActionListener(this);

}//end of edit menu

public void actionPerformed(ActionEvent e)

{

JMenuItem mItem = (JMenuItem)e.getSource();

if(mItem == x)

{

System.exit(0);

}

else if(mItem == help)

{

new HelpScreen();

}

else if(mItem == addE)

{

new FourthScreen();

}

else if(mItem == updateE)

{

new Dating();

}

else if(mItem == deleteE)

{

new DeleteScreen();

}

else if(mItem == searchE)

{

new SearchScreen();

}

else if(mItem == staff)

{

new NewStaff();

}

}

public static void main (String args[])throws Exception

{

new ThirdScreen();

}

}

import java.sql.*;

import java.util.ArrayList;

import javax.swing.*;

import java.awt.event.*;

import java.awt.*;

import java.util.*;

public class Dating

{

public Dating() throws Exception

{

String name = JOptionPane.showInputDialog("Please enter the patient number");

if(name == null)

{

new ThirdScreen();

}

String pass = "Are you sure you want to update this Patient?";

int answer = JOptionPane.showConfirmDialog(null,

pass,"Confirmation" , JOptionPane.YES_NO_OPTION);

if (answer == JOptionPane.YES_OPTION)

{

Updating s =new Updating(name);

}

else

{

new ThirdScreen();

}

}

}

//This class is used for updating purposes

//for the patient.

import javax.swing.*;

import java.awt.event.*;

import java.awt.*;

public class Updating extends JFrame

{

//set variables to be used

private JButton enter,save,back,exit,help;

private JLabel name,surname,address,tell,reason,no;

public JTextField naam,van,add,tel,re,num;

private BackButtonHandler BackHandler;

private ExitButtonHandler ExitHandler;

private SaveButtonHandler SaveHandler;

private HelpButtonHandler HelpHandler;

private String sire;

public Updating(String numb) throws Exception

{

Container cont = getContentPane();

cont.setLayout(null);

cont.setBackground(new Color(0,200,255));

// initialize variables

enter = new JButton("PLEASE ENTER PATIENTS INFORMATION");

save = new JButton("SAVE");

back = new JButton("BACK");

exit = new JButton("EXIT");

help = new JButton("HELP");

no = new JLabel("PATIENT NUMBER:");

name = new JLabel("FIRST NAMES:");

surname = new JLabel("LAST NAME:");

address = new JLabel("ADDRESS:");

tell = new JLabel("TEL NUMBER(Reachable Number):");

reason = new JLabel("REASON FOR COMING:");

num = new JTextField(10);

naam = new JTextField(20);

van = new JTextField(20);

add = new JTextField(30);

tel = new JTextField(10);

re = new JTextField(30);

sire = numb;

num.setText(sire);

enter.setSize(700,50);

save.setSize(100,50);

back.setSize(100,50);

no.setSize(130,50);

name.setSize(100,50);

surname.setSize(100,50);

address.setSize(100,50);

tell.setSize(200,50);

reason.setSize(200,50);

num.setSize(100,30);

naam.setSize(100,30);

van.setSize(100,30);

add.setSize(200,50);

tel.setSize(100,30);

re.setSize(200,50);

exit.setSize(100,50);

help.setSize(100,50);

enter.setLocation(0,0);

save.setLocation(550,500);

back.setLocation(0,500);

no.setLocation(100,50);

name.setLocation(100,100);

surname.setLocation(100,150);

address.setLocation(100,200);

tell.setLocation(100,280);

reason.setLocation(100,330);

num.setLocation(300,60);

naam.setLocation(300,110);

van.setLocation(300,150);

add.setLocation(300,200);

tel.setLocation(300,290);

re.setLocation(300,330);

exit.setLocation(100,500);

help.setLocation(200,500);

//insert variables in frame

cont.add(enter);

cont.add(save);

cont.add(back);

cont.add(no);

cont.add(name);

cont.add(surname);

cont.add(address);

cont.add(tell);

cont.add(reason);

cont.add(num);

cont.add(naam);

cont.add(van);

cont.add(add);

cont.add(tel);

cont.add(re);

cont.add(exit);

cont.add(help);

BackHandler = new BackButtonHandler(this);

ExitHandler = new ExitButtonHandler();

SaveHandler = new SaveButtonHandler(this);

HelpHandler = new HelpButtonHandler();

back.addActionListener(BackHandler);

exit.addActionListener(ExitHandler);

save.addActionListener(SaveHandler);

help.addActionListener(HelpHandler);

setTitle("Patients Information");

setSize(700,600);

setVisible(true);

setDefaultCloseOperation(EXIT_ON_CLOSE);

}// end of method

// method used when the back button is pressed

private class BackButtonHandler implements ActionListener

{

private JFrame fr;

public BackButtonHandler(JFrame frame)

{

fr = frame;

}

public void actionPerformed (ActionEvent g)

{

new ThirdScreen();

fr.hide();

}

}// end backbuttonHandler

//start of Exit buttonHandler

//

private class ExitButtonHandler implements ActionListener

{

public void actionPerformed (ActionEvent s)

{

System.exit(0);

}

}//end Exit button handler

private class HelpButtonHandler implements ActionListener

{

public void actionPerformed (ActionEvent s)

{

new HelpScreen();

}

}//end Exit button handler

//Start of savebutton

private class SaveButtonHandler implements ActionListener

{

private JFrame fr;

double s;

int p;

public SaveButtonHandler(JFrame frame)

{

fr = frame;

}

public void actionPerformed (ActionEvent q)

{

try

{

Updateconnect connect = new Updateconnect();

connect.getData(num,naam,van,add,tel,re);

String ms = "Patient Updated";

JOptionPane.showMessageDialog(null, ms,"Updating", JOptionPane.INFORMATION_MESSAGE);

new ThirdScreen();

fr.hide();

}

catch(Exception e)

{

e.printStackTrace();

}

}

}//end of exitbutton

}>

[12919 byte] By [Da-Sa] at [2007-10-2 0:50:18]
# 1
Hi,You should use code formatting when you post code, and you should also post the error messages that you get./Kaj
kajbja at 2007-7-15 18:00:36 > top of Java-index,Java Essentials,New To Java...