diff --git a/.idea/artifacts/RealTimeSerialPlotter_jar.xml b/.idea/artifacts/RealTimeSerialPlotter_jar.xml new file mode 100644 index 0000000..79f253f --- /dev/null +++ b/.idea/artifacts/RealTimeSerialPlotter_jar.xml @@ -0,0 +1,11 @@ + + + $PROJECT_DIR$/out/artifacts/RealTimeSerialPlotter_jar + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index bdc94d8..27321b1 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/META-INF/MANIFEST.MF b/src/META-INF/MANIFEST.MF new file mode 100644 index 0000000..9fef7b6 --- /dev/null +++ b/src/META-INF/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Class-Path: purejavacomm-1.0.2.RELEASE.jar +Main-Class: application.Main + diff --git a/src/application/Main.java b/src/application/Main.java index e3eb3b3..6f3f82c 100644 --- a/src/application/Main.java +++ b/src/application/Main.java @@ -4,6 +4,7 @@ import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; +import javafx.scene.image.Image; import javafx.stage.Stage; import mainwindow.CaptureController; import plot.Plot; @@ -22,6 +23,9 @@ public void start(Stage primaryStage) throws Exception primaryStage.setMinHeight(450.0); primaryStage.setMinWidth(620.0); + Image applicationIcon = new Image(getClass().getResourceAsStream("icon.png")); + primaryStage.getIcons().add(applicationIcon); + primaryStage.setOnCloseRequest(event -> { CaptureController.isActiveExport = false; diff --git a/src/application/RealTimeSerialPlotter_box.png b/src/application/RealTimeSerialPlotter_box.png new file mode 100644 index 0000000..b3774cc Binary files /dev/null and b/src/application/RealTimeSerialPlotter_box.png differ diff --git a/src/application/icon.png b/src/application/icon.png new file mode 100644 index 0000000..b849f9e Binary files /dev/null and b/src/application/icon.png differ diff --git a/src/mainwindow/CaptureController.java b/src/mainwindow/CaptureController.java index 99a00fd..76e8c54 100644 --- a/src/mainwindow/CaptureController.java +++ b/src/mainwindow/CaptureController.java @@ -85,7 +85,7 @@ public void startOverwriteClick() { file = new File(filePathTextField.getText()); - if(file.exists()) + if(file.getPath().substring(file.getPath().length() - 3, file.getPath().length()).equals("txt")) { if(PortReader.getInstance().isOpen()) { @@ -155,7 +155,7 @@ public void startOverwriteClick() } else { - showErrorAlert("Podana ścieżka jest niepoprawna!"); + showErrorAlert("Given path is wrong!"); } } diff --git a/src/mainwindow/PortController.java b/src/mainwindow/PortController.java index 9a704c6..12afe87 100644 --- a/src/mainwindow/PortController.java +++ b/src/mainwindow/PortController.java @@ -1,5 +1,6 @@ package mainwindow; +import javafx.scene.control.Alert; import plot.Plot; import port.PortReader; import javafx.fxml.FXML; @@ -115,6 +116,17 @@ public void onActionConnectButton() PortReader.getInstance().startReading(); Plot.getInstance().startPlotting(); } + else + { + Log.getInstance().log("An attempt to open the port was unsuccessful."); + + Alert alert = new Alert(Alert.AlertType.WARNING); + + alert.setTitle("Real Time Serial Plotter"); + alert.setHeaderText(null); + alert.setContentText("Port is already in use. Cannot open."); + alert.showAndWait(); + } } } else diff --git a/src/mainwindow/captureView.fxml b/src/mainwindow/captureView.fxml index d90d4db..79781c6 100644 --- a/src/mainwindow/captureView.fxml +++ b/src/mainwindow/captureView.fxml @@ -33,7 +33,7 @@ - + diff --git a/src/port/Port.java b/src/port/Port.java index a926b2b..8ece4b6 100644 --- a/src/port/Port.java +++ b/src/port/Port.java @@ -100,9 +100,6 @@ public boolean open(String serialPortName, int dataBits, int stopBits, int parit } catch (Throwable thwble) { - Log.getInstance().log("An attempt to open the port was unsuccessful."); - thwble.printStackTrace(); - return false; } }