Skip to content

Commit

Permalink
added a output window popup
Browse files Browse the repository at this point in the history
  • Loading branch information
prakadesh committed Oct 26, 2023
1 parent 0d2cb04 commit e2b6ec8
Showing 1 changed file with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -550,15 +550,34 @@ buttonBox, errorLabel, createOutputTextArea(), hbox_gauge


// Add a method to display the output in a new window or dialog
private TextArea createOutputTextArea() {
private VBox createOutputTextArea() {
outputTextArea = new TextArea();
outputTextArea.setEditable(false);
outputTextArea.setWrapText(true);
outputTextArea.setPrefRowCount(10); // Set the number of visible rows
return outputTextArea;
outputTextArea.setPrefRowCount(10);// Set the number of visible rows
Button openOutputWindowButton = new Button("Open Output Window");
openOutputWindowButton.setOnAction(e -> openOutputWindow(outputTextArea));
openOutputWindowButton.setVisible(false);
openOutputWindowButton.setManaged(false);
VBox vbox_outputtextarea = new VBox(10, openOutputWindowButton, outputTextArea);
return vbox_outputtextarea;
}

// Method to display the output in the TextArea
private void openOutputWindow(TextArea outputTextArea) {
Stage outputStage = new Stage();
outputStage.setTitle("Energy Monitoring Output");
TextArea outputInWindow = new TextArea(outputTextArea.getText());
outputInWindow.setEditable(false);
outputInWindow.setStyle(darkModeStyles);
outputInWindow.setWrapText(true);

Scene outputScene = new Scene(new StackPane(outputInWindow), 800, 600);

outputStage.setScene(outputScene);
outputStage.show();
}

// Method to display the output in the TextArea
private void displayOutputInTextArea(String output) {
outputTextArea.appendText("\nEnergy Monitoring Output:\n" + output);
outputTextArea.positionCaret(outputTextArea.getText().length());
Expand Down

0 comments on commit e2b6ec8

Please sign in to comment.