我希望将信息放入字段中,以搜索带有数据的链表,并且如果该信息与列表中的患者匹配,它将把该患者放入治疗队列。我只是想知道如何在其中获取应用程序的链接列表部分以及如何获取队列。我当时正在考虑使用文本文件和扫描仪来读取链接列表的文本文件,但是我不确定什么是最佳选择。我对此并不陌生,所以对如何处理不太熟悉。
package application;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
public class Healthcare extends Application {
ComboBox<String> cboYear = new ComboBox<>();
ComboBox<String> cboGender = new ComboBox<>();
ComboBox<String> cboInjury = new ComboBox<>();
TextField tfName = new TextField();
Button btAcceptPatient = new Button("Accept Patient");
Label lblResults = new Label("");
public void start(Stage primaryStage) {
btAcceptPatient.setOnAction(e -> displayMessage());
Scene scene = new Scene(getPane(), 300, 160);
primaryStage.setTitle("Healthcare");
primaryStage.setScene(scene);
primaryStage.show();
}
private void displayMessage() {
lblResults.setText(getGender() + " name "
+ tfName.getText() + " Born in: " + cboYear.getValue() + "with an injury of: " + cboInjury.getValue()
+ " is ranked admmitted and positioned in the que for treatment");
}
private String getGender() {
return cboGender.getValue().equals("Male") ? "Male" : "Female";
}
/** Returns the ranking pane */
private BorderPane getPane() {
// Add items to cboYear
for (int i = 1920; i <= 2019; i++)
cboYear.getItems().add(i + "");
// Add items to cboGender
cboGender.getItems().addAll("Male", "Female");
// Add items to Injury
cboInjury.getItems().addAll("Broken Arm", "Broken Leg", "Dehydrated", "Stroke", "Heart Attack", "Flu", "Shingles");
GridPane gridPane = new GridPane();
gridPane.setVgap(5);
gridPane.setPadding(new Insets(10, 0, 10, 0));
gridPane.setAlignment(Pos.CENTER);
gridPane.add(new Label("Select your injury: "), 0, 3);
gridPane.add(cboInjury, 1, 3);
gridPane.add(new Label("Year born: "), 0, 2);
gridPane.add(cboYear, 1, 2);
gridPane.add(new Label("Male or Female?: "), 0, 1);
gridPane.add(cboGender, 1, 1);
gridPane.add(new Label("Enter patient name: "), 0, 0);
gridPane.add(tfName, 1, 0);
gridPane.add(btAcceptPatient, 1, 4);
BorderPane pane = new BorderPane();
pane.setCenter(gridPane);
pane.setBottom(lblResults);
pane.setAlignment(lblResults, Pos.CENTER);
return pane;
}
public static void main(String[] args) {
launch(args);
}
}