patient registration form in java swing
#1

I am new to Java ..but i am in need of submitting project on patient registeration form using swing in java.. the details of the patient should be entered some fields should be mandatory and if those fields are not filled then the message should be displayed that the field is mandatory..after filling the patient details next page should be displayed for doctors details..then after clicking register "the patient is registered" message should be displayed ..on clicking ok the window should be closed..these are the requirements of this project..can you give me a code for this please?..
Reply
#2

patient registration form in java swing

JAVA SOURCE CODE FOR PATIENT REGISTRATION INTERFACE
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public class Patient extends JFrame implements ActionListener

{
public static void main(String [] args)
{

new Patient();
}

JTextField pName, doBirth, hAddress,hospital,diagnosis;
JComboBox sex;
JRadioButton medical, dentistry, optical,oPatient,admitted;
JCheckBox died, discharged;
JButton Apply, clearButton, exitButton;
String[] theBox= {"male","female"};
public Patient()

{
this.setTitle("PATIENT REGISTRATION FORM");
this.setDefaultCloseOperation(
JFrame.EXIT_ON_CLOSE);

JPanel panel1 = new JPanel();
panel1.setLayout(new GridBagLayout());
addItem(panel1, new JLabel("FULL NAME OF PATIENT:"),
0, 0, 1, 1, GridBagConstraints.EAST);
addItem(panel1, new JLabel("DATE OF BIRTH:"),
0, 1, 1, 1, GridBagConstraints.EAST);
addItem(panel1, new JLabel("HOME ADDRESS ( Vge / TA / District):"),
0, 2, 1, 1, GridBagConstraints.EAST);
addItem(panel1, new JLabel("SEX:"),
0, 3, 1, 1, GridBagConstraints.EAST);
addItem(panel1, new JLabel("HOSPITAL:"),

0, 4, 1, 1, GridBagConstraints.EAST);
addItem(panel1, new JLabel("DIAGNOSIS:"),
0, 5, 1, 1, GridBagConstraints.EAST);


pName = new JTextField(20);
doBirth = new JTextField(20);
hAddress = new JTextField(20);

sex = new JComboBox(theBox);
hospital = new JTextField(20);
diagnosis= new JTextField(20);


addItem(panel1, pName, 1, 0, 2, 1,
GridBagConstraints.WEST);
addItem(panel1, doBirth, 1, 1, 1, 1,
GridBagConstraints.WEST);
addItem(panel1, hAddress, 1, 2, 2, 1,
GridBagConstraints.WEST);

addItem(panel1, sex, 1, 3, 2, 1,
GridBagConstraints.WEST);
addItem(panel1,hospital, 1,4,2,1,
GridBagConstraints.WEST);

addItem(panel1, diagnosis, 1,5,2,1,
GridBagConstraints.WEST);


Box sizeBox = Box.createVerticalBox();
medical = new JRadioButton("medical");
dentistry = new JRadioButton("dentistry");
optical = new JRadioButton("optical");

ButtonGroup sizeGroup = new ButtonGroup();
sizeGroup.add(medical);
sizeGroup.add(dentistry);
sizeGroup.add(optical);
sizeBox.add(medical);
sizeBox.add(dentistry);
sizeBox.add(optical);

sizeBox.setBorder(
BorderFactory.createTitledBorder("TREATMENT"));
addItem(panel1, sizeBox, 0,6, 1, 1,
GridBagConstraints.NORTH);

Box styleBox = Box.createVerticalBox();
oPatient = new JRadioButton("Out Patient");
admitted = new JRadioButton("Admitted");
ButtonGroup styleGroup = new ButtonGroup();

styleGroup.add(oPatient);
styleGroup.add(admitted);
styleBox.add(oPatient);
styleBox.add(admitted);
styleBox.setBorder(BorderFactory.

createTitledBorder("RHESUS FACTOR"));
addItem(panel1, styleBox, 1,6, 1, 1,
GridBagConstraints.NORTH);

Box topBox = Box.createVerticalBox();
discharged = new JCheckBox("yes");
died = new JCheckBox("no");

ButtonGroup topGroup = new ButtonGroup();
topGroup.add(discharged);
topGroup.add(died);

topBox.add(discharged);
topBox.add(died);
topBox.setBorder(BorderFactory.

createTitledBorder("APPOINTMENT"));
addItem(panel1, topBox, 2, 6, 1, 1,
GridBagConstraints.NORTH);

Box buttonBox = Box.createHorizontalBox();
Apply = new JButton("Apply");
clearButton = new JButton("Clear");
exitButton = new JButton("Exit");

buttonBox.add(Apply);
buttonBox.add(Box.createHorizontalStrut(25));
buttonBox.add(clearButton);
clearButton.addActionListener(this);
buttonBox.add(Box.createHorizontalStrut(25));
buttonBox.add(exitButton);
exitButton.addActionListener(this);
addItem(panel1, buttonBox, 0, 7, 3, 1, GridBagConstraints.CENTER);

pName.setText(" ");
doBirth.setText(" ");
hAddress.setText(" ");
hospital.setText(" ");
diagnosis.setText(" ");

oPatient.setText("positive ");
oPatient.setSelected(true);

admitted.setText("negative ");
admitted.setSelected(true);

medical.setText("medical");
medical.setSelected(true);

dentistry.setText("dentistry");
dentistry.setSelected(true);

optical.setText("optical");
optical.setSelected(true);

discharged.setText("yes ");
discharged.setSelected(true);

died.setText("no ");
died.setSelected(true);

Apply.setText("Apply");
Apply.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
JTextArea textarea=new JTextArea();
JScrollPane scroll=new JScrollPane( textarea,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

JFrame frame= new JFrame();

if (e.getSource()==Apply){
String name= pName.getText();
textarea.append("\n\n");
textarea.append(" FULL NAME OF PATIENT: "+name+"\n\n");

String name1= doBirth.getText();
textarea.append(" DATE OF BIRTH: "+name1+"\n\n");

String name3 = hAddress.getText();
textarea.append(" HOME ADDRESS (Vge / TA / District): "+ name3+"\n\n");
String enteredText = (String)sex.getSelectedItem();
textarea.append(" SEX: "+enteredText+"\n\n");

String name4=hospital.getText();
textarea.append(" HOSPITAL: "+name4+"\n\n");

String name5=diagnosis.getText();
textarea.append(" DIAGNOSIS: "+name5+"\n\n");

if (oPatient.isSelected())
textarea.append(" RHESUS FACTOR: positive\n\n");
if (admitted.isSelected())
textarea.append(" RHESUS FACTOR: negative\n\n");

if (medical.isSelected())
textarea.append(" TREATMENT: Medical\n\n");
if (dentistry.isSelected())
textarea.append(" TREATMENT: Dentistry\n\n");
if (optical.isSelected())
textarea.append(" TREATMENT: Optical\n\n");

if (discharged.isSelected())
textarea.append(" APPOINTMENT: Yes\n\n");
if (died.isSelected())
textarea.append(" APPOINTMENT: No\n\n");

textarea.setEditable(false);
}
frame.add(scroll);
frame.setTitle(" DETAILS OF REGISTERED PATIENT");
frame.setSize(500,500);
frame.setLocation(350,50);
frame.setVisible(true);

}
});

this.add(panel1);
this.pack();
this.setVisible(true);
}

public void actionPerformed(ActionEvent evnt){
if(evnt.getSource()==exitButton){
System.exit(0);
}
else if (evnt.getSource()==clearButton){
cancel1();
}
}

public void cancel1() {
pName.setText("");

}

private void addItem(JPanel p, JComponent c,
int x, int y, int width, int height,
int align)
{
GridBagConstraints gc =
new GridBagConstraints();
gc.gridx = x;
gc.gridy = y;
gc.gridwidth = width;
gc.gridheight = height;
gc.weightx = 100.0;
gc.weighty = 100.0;
gc.insets = new Insets(20, 20, 20, 20);
gc.anchor = align;
gc.fill = GridBagConstraints.NONE;
p.add(c, gc);
}
}
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: create student registration form using swing, a simple registration form project using java swing, train reservation form source code in java swing, patient information form, registration form in swing source code, user registration form in java swings, java swing program for registration form,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
Smile sbi savings account to rsp convertion form 5 3,495 15-06-2018, 07:42 AM
Last Post: Atanu Dey
  dwt code in java for image 2 6,352 24-03-2018, 10:06 PM
Last Post: Guest
  jubasree form online application 2015 1 1,226 01-01-2018, 12:27 PM
Last Post: dhanabhagya
  to find whether a number is krishnamurthy number or not using java 1 11,261 01-01-2018, 11:39 AM
Last Post: dhanabhagya
  java programmings for bus ticket reservation source code 1 6,221 09-11-2017, 11:28 PM
Last Post: Ayushi Nagar
  amar ujala rupayan cover photo registration 1 8,372 23-06-2017, 08:23 AM
Last Post: Sadhana chaubey
Wink student online counselling simple projects in core java with source code 3 6,832 10-06-2017, 10:21 AM
Last Post: jaseela123d
  bsnl inplant training registration in pondicherry 2 1,284 27-05-2017, 01:32 PM
Last Post: jaseela123d
  summer training in ntpc dadri 2015 application form 3 1,299 11-05-2017, 09:37 AM
Last Post: jaseela123d
  government scheme management system in java 2 6,151 26-04-2017, 11:40 PM
Last Post: dumpo

Forum Jump: