private void viewBtnActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_viewBtnActionPerformed // TODO add your handling code here: int selectedRow = vitalSignTable.getSelectedRow(); if (selectedRow >= 0) { VitalSign vs = (VitalSign) vitalSignTable.getValueAt(selectedRow, 4); respRateTextField.setText(String.valueOf(vs.getRespRate())); heartRateTextField.setText(String.valueOf(vs.getHeartRate())); bpTextField.setText(String.valueOf(vs.getBp())); weightTextField.setText(String.valueOf(vs.getWeight())); timeTextField.setText(String.valueOf(vs.getTime())); } else { JOptionPane.showMessageDialog( this, "Please select a row!", "Warning", JOptionPane.WARNING_MESSAGE); } } // GEN-LAST:event_viewBtnActionPerformed
public void populateTable() { DefaultTableModel dtm = (DefaultTableModel) vitalSignTable.getModel(); dtm.setRowCount(0); for (VitalSign vs : vitalSignHistory.getVitalSignList()) { Object row[] = new Object[6]; row[0] = vs.getRespRate(); row[1] = vs.getHeartRate(); row[2] = vs.getBp(); row[3] = vs.getWeight(); row[4] = vs; if (profile.getAge() >= 1 && profile.getAge() <= 3) { if (((vs.getRespRate() < 20) || (vs.getRespRate() > 30)) || (vs.getHeartRate() < 80) || (vs.getHeartRate() > 130) || (vs.getBp() < 80) || (vs.getBp() > 110) || (vs.getWeight() < 22) || (vs.getWeight() > 31)) { row[5] = "Abnormal"; } else { row[5] = "Normal"; } } else if (profile.getAge() >= 4 && profile.getAge() <= 5) { if (((vs.getRespRate() < 20) || (vs.getRespRate() > 30)) || (vs.getHeartRate() < 80) || (vs.getHeartRate() > 120) || (vs.getBp() < 80) || (vs.getBp() >= 110) || (vs.getWeight() < 31) || (vs.getWeight() > 40)) { row[5] = "Abormal"; } else { row[5] = "Normal"; } } else if (profile.getAge() >= 6 && profile.getAge() <= 12) { if (((vs.getRespRate() < 20) || (vs.getRespRate() > 30)) || (vs.getHeartRate() < 70) || (vs.getHeartRate() > 110) || (vs.getBp() < 80) || (vs.getBp() >= 120) || (vs.getWeight() < 41) || (vs.getWeight() >= 92)) { row[5] = "Abnormal"; } else { row[5] = "Normal"; } } else { if (((vs.getRespRate() < 12) || (vs.getRespRate() > 20)) || (vs.getHeartRate() < 55) || (vs.getHeartRate() > 105) || (vs.getBp() < 110) || (vs.getBp() >= 120) || (vs.getWeight() > 110)) { row[5] = "Abnormal"; } else { row[5] = "Normal"; } } dtm.addRow(row); } }