import javafx.scene.layout.HBox; //导入方法依赖的package包/类
public HBox createTopBar()
{
HBox hbox = new HBox();
hbox.setPadding(new Insets(15, 15, 15, 15));
hbox.setSpacing(10);
hbox.setStyle("-fx-background-color: lightsteelblue;");
ObservableList buttons = hbox.getChildren();
Set buttonEffectsSet = new HashSet<>();
Node runButton = new ImageView("toolbar_run.png");
runButton.setOnMouseClicked((event) -> {
// TODO: Attach to Backend
});
buttons.add(runButton);
buttonEffectsSet.add(runButton);
Node stepButton = new ImageView("toolbar_step.png");
runButton.setOnMouseClicked((event) -> {
// TODO: Attach to Backend
});
buttons.add(stepButton);
buttonEffectsSet.add(stepButton);
Node resetButton = new ImageView("toolbar_reset.png");
runButton.setOnMouseClicked((event) -> {
// TODO: Attach to Backend
});
buttons.add(resetButton);
buttonEffectsSet.add(resetButton);
buttonEffectsSet.forEach(EmulationWindow::setButtonEffect);
Label cycleLabel = new Label();
cycleLabel.setText("Cycle: ");
cycleLabel.setFont(Font.font("Arial", FontWeight.NORMAL, 18));
buttons.add(cycleLabel);
Label cycleLabelCount = new Label();
cycleLabelCount.setText("0");
cycleLabelCount.setFont(Font.font("Arial", FontWeight.NORMAL, 18));
buttons.add(cycleLabelCount);
Label stepLabel = new Label();
stepLabel.setText("Step: ");
stepLabel.setFont(Font.font("Arial", FontWeight.NORMAL, 18));
buttons.add(stepLabel);
Label stepLabelCount = new Label();
stepLabelCount.setText("0");
stepLabelCount.setFont(Font.font("Arial", FontWeight.NORMAL, 18));
buttons.add(stepLabelCount);
Label simModeState = new Label();
simModeState.setText("Sim Mode");
simModeState.setFont(Font.font("Arial", FontWeight.NORMAL, 16));
buttons.add(simModeState);
Node simModeImage = new ImageView("sim_mode_on.png");
buttons.add(simModeImage);
return hbox;
}