import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Patient extends JFrame
{
// Declare a reference to PatientClass
private PatientClass p1 = new PatientClass();
public Patient()
{
// Default constructor
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
dispose();
System.exit(0);
}
});
// Instantiate an object of PatientClass type
//p1 = new PatientClass();
p1.setDetails("Bill Clinton",55,"WM223344C");
}
public void paint(Graphics g) {
// All drawing done here, therefore this is the
// place to call displayDetails
// Pass an object g of class Graphics over to displayDetails
p1.displayDetails(g,30,100);
}
public static void main(String args[])
{
Patient mainFrame = new Patient();
PatientClass p = new PatientClass();
mainFrame.setSize(400, 400);
mainFrame.setTitle("Patient");
mainFrame.setVisible(true);
}
}
|