Question
I need help to modify my code, and those schemas into my JAVA GUI code, ( Now I only have patient) import java.awt.event.ActionEvent; import java.awt.event.ActionListener;
I need help to modify my code, and those schemas into my JAVA GUI code, ( Now I only have patient)
import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.FlowLayout; import java.awt.GridLayout; import java.util.List; import javax.swing.JButton; import javax.swing.Box; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.WindowConstants; import javax.swing.BoxLayout; import javax.swing.BorderFactory; import javax.swing.JOptionPane;
public class Display extends JFrame{ private Patient currentEntry; private Queries personQueries; private List
public Display() { super("Patient"); personQueries = new Queries(); navigatePanel = new JPanel(); previousButton = new JButton(); indexTextField = new JTextField(2); ofLabel = new JLabel(); maxTextField = new JTextField(2); nextButton = new JButton(); displayPanel = new JPanel(); idLabel = new JLabel(); idTextField = new JTextField(10); firstNameLabel = new JLabel(); firstNameTextField = new JTextField(10); lastNameLabel = new JLabel(); lastNameTextField = new JTextField(10); emailLabel = new JLabel(); emailTextField = new JTextField(10); phoneLabel = new JLabel(); phoneTextField = new JTextField(10); addressLabel = new JLabel(); addressTextField = new JTextField(10); queryPanel = new JPanel(); queryLabel = new JLabel(); queryTextField = new JTextField(10); queryButton = new JButton(); browseButton = new JButton(); insertButton = new JButton(); deleteButton = new JButton(); updateButton = new JButton(); setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10)); setSize(1200, 800); setResizable(true);
navigatePanel.setLayout(new BoxLayout(navigatePanel, BoxLayout.X_AXIS)); previousButton.setText("Previous"); previousButton.setEnabled(false); previousButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { previousButtonActionPerformed(e); } } );
navigatePanel.add(previousButton); navigatePanel.add(Box.createHorizontalStrut(10));
indexTextField.setHorizontalAlignment(JTextField.CENTER); indexTextField.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { indexTextFieldActionPerformed(e); } } );
navigatePanel.add(indexTextField); navigatePanel.add(Box.createHorizontalStrut(10));
ofLabel.setText("of"); navigatePanel.add(ofLabel); navigatePanel.add(Box.createHorizontalStrut(10));
maxTextField.setHorizontalAlignment(JTextField.CENTER); maxTextField.setEditable(false); navigatePanel.add(maxTextField); navigatePanel.add(Box.createHorizontalStrut(10));
nextButton.setText("Next"); nextButton.setEnabled(false); nextButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { nextButtonActionPerformed(e); } } );
navigatePanel.add(nextButton); add(navigatePanel);
displayPanel.setLayout(new GridLayout(6, 3, 4, 4));
idLabel.setText("Id:"); displayPanel.add(idLabel); idTextField.setEditable(false); displayPanel.add(idTextField);
firstNameLabel.setText("First Name:"); displayPanel.add(firstNameLabel); displayPanel.add(firstNameTextField);
lastNameLabel.setText("Last Name:"); displayPanel.add(lastNameLabel); displayPanel.add(lastNameTextField);
phoneLabel.setText("Phone Number:"); displayPanel.add(phoneLabel); displayPanel.add(phoneTextField);
addressLabel.setText("Address"); displayPanel.add(addressLabel); displayPanel.add(addressTextField);
add(displayPanel);
queryPanel.setLayout(new BoxLayout(queryPanel, BoxLayout.X_AXIS)); queryPanel.setBorder(BorderFactory.createTitledBorder("Find an entry by State")); queryLabel.setText("Address:"); queryPanel.add(Box.createHorizontalStrut(5)); queryPanel.add(queryLabel); queryPanel.add(Box.createHorizontalStrut(10)); queryPanel.add(queryTextField); queryPanel.add(Box.createHorizontalStrut(10));
browseButton.setText("Browse All Entries"); browseButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { browseButtonActionPerformed(e); } } );
add(browseButton);
addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { personQueries.close(); System.exit(0); } } ); setVisible(true); }
private void previousButtonActionPerformed(ActionEvent e) { currentEntryIndex--; if(currentEntryIndex
indexTextField.setText("" + (currentEntryIndex + 1)); indexTextFieldActionPerformed(e); }
private void nextButtonActionPerformed(ActionEvent e){ currentEntryIndex++;
if(currentEntryIndex >= numberofEntries) currentEntryIndex = 0; indexTextField.setText(""+ (currentEntryIndex+1)); indexTextFieldActionPerformed(e); }
private void indexTextFieldActionPerformed(ActionEvent e){ currentEntryIndex = (Integer.parseInt(indexTextField.getText())-1);
if(numberofEntries != 0 && currentEntryIndex
} }
private void browseButtonActionPerformed(ActionEvent e){ try { results = personQueries.getAllPeople(); numberofEntries = results.size();
if (numberofEntries != 0) { currentEntryIndex = 0; currentEntry = results.get(currentEntryIndex); idTextField.setText("" + currentEntry.getID()); firstNameTextField.setText(currentEntry.getFirstName()); lastNameTextField.setText(currentEntry.getLastName()); emailTextField.setText(currentEntry.getEmail()); phoneTextField.setText(Integer.toString(currentEntry.getPhoneNumber())); addressTextField.setText(Integer.toString(currentEntry.getAddress())); maxTextField.setText("" + numberofEntries); indexTextField.setText("" + (currentEntryIndex + 1)); nextButton.setEnabled(true); previousButton.setEnabled(true); } } catch (Exception exception){ exception.printStackTrace(); } }
public static void main(String[] args) { new Display(); }
}
Patient id firstname lastname phone address id addressi Prescriber id firstname lastname license_id street companyn phone Country Address id Cit State ZipCode Drug_Company id Payment_Method id ame phone description prescriber Prescription id patient idid drugname drugcost amount drug id date of filled paymentmethod_id drug compa ny id Drug id unit dose prescription i Prescription_ltems d *Payment_method: the description can be cash/insurance/credit card Patient id firstname lastname phone address id addressi Prescriber id firstname lastname license_id street companyn phone Country Address id Cit State ZipCode Drug_Company id Payment_Method id ame phone description prescriber Prescription id patient idid drugname drugcost amount drug id date of filled paymentmethod_id drug compa ny id Drug id unit dose prescription i Prescription_ltems d *Payment_method: the description can be cash/insurance/credit cardStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started