diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..d6b5811
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..6319f17
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Butterflies2.iml b/Butterflies2.iml
new file mode 100644
index 0000000..a7b7b34
--- /dev/null
+++ b/Butterflies2.iml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/fxml/MainWindow.fxml b/resources/fxml/MainWindow.fxml
index 03e1cab..c941a0a 100644
--- a/resources/fxml/MainWindow.fxml
+++ b/resources/fxml/MainWindow.fxml
@@ -27,7 +27,7 @@
-
@@ -44,7 +44,8 @@
diff --git a/src/data/Loadable.java b/src/data/Loadable.java
index 7160525..1c3d77b 100644
--- a/src/data/Loadable.java
+++ b/src/data/Loadable.java
@@ -1,5 +1,5 @@
package data;
public interface Loadable {
- public T load();
+ T load();
}
diff --git a/src/data/Stub.java b/src/data/Stub.java
index 0e702c8..ba9996d 100644
--- a/src/data/Stub.java
+++ b/src/data/Stub.java
@@ -9,15 +9,6 @@ public class Stub implements Loadable {
public ButterflyManager load() {
ButterflyManager result = new ButterflyManager();
- Butterfly jerry = new Butterfly("Jerry");
- jerry.addColor(50, 100, 150);
- jerry.addColor(20, 0, 240);
-
- Butterfly tony = new Butterfly("Tony");
- tony.addColor(50, 100, 150);
- tony.addColor(150, 0, 150);
- tony.addColor(0, 100, 0);
-
result.addButterfly("Jerry");
result.getButterflies().get(0).addColor(50, 100, 150);
result.getButterflies().get(0).addColor(150, 0, 150);
diff --git a/src/launcher/Launcher.java b/src/launcher/Launcher.java
index 2c7cfd6..234f3d3 100644
--- a/src/launcher/Launcher.java
+++ b/src/launcher/Launcher.java
@@ -11,7 +11,7 @@ import java.util.Objects;
public class Launcher extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
- Parent root = FXMLLoader.load(getClass().getResource("/fxml/MainWindow.fxml"));
+ Parent root = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/MainWindow.fxml")));
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.show();
diff --git a/src/view/CreationWindow.java b/src/view/CreationWindow.java
index 0c1da02..b846791 100644
--- a/src/view/CreationWindow.java
+++ b/src/view/CreationWindow.java
@@ -27,6 +27,6 @@ public class CreationWindow {
}
public String getButterflyName() {
- return null;
+ return butterflyName;
}
}
diff --git a/src/view/MainWindow.java b/src/view/MainWindow.java
index 196f4c7..45d0667 100644
--- a/src/view/MainWindow.java
+++ b/src/view/MainWindow.java
@@ -33,9 +33,9 @@ public class MainWindow {
if (colorPicker.getValue() != null) {
butterfliesLV.getSelectionModel()
.getSelectedItem()
- .addColor((int) (colorPicker.getValue().getRed()),
- (int) (colorPicker.getValue().getGreen()),
- (int) (colorPicker.getValue().getBlue()));
+ .addColor((int) (colorPicker.getValue().getRed() * 255),
+ (int) (colorPicker.getValue().getGreen() * 255),
+ (int) (colorPicker.getValue().getBlue()) * 255);
}
}
@@ -61,13 +61,10 @@ public class MainWindow {
Stage creationWindowStage = new Stage();
creationWindowStage.initOwner(butterfliesLV.getScene().getWindow());
creationWindowStage.initModality(Modality.WINDOW_MODAL);
-
CreationWindow controller = initCreationWindow(creationWindowStage);
-
if (controller.getButterflyName() != null) {
mgr.addButterfly(controller.getButterflyName());
}
-
}
private CreationWindow initCreationWindow(Stage creationWindowStage) {
@@ -76,10 +73,9 @@ public class MainWindow {
loader.setController(controller);
try {
creationWindowStage.setScene(new Scene(loader.load()));
+ creationWindowStage.showAndWait();
} catch (IOException ex) {
- new Alert(Alert.AlertType.ERROR,
- "error while opening creation window",
- ButtonType.OK).setHeaderText(null);
+ new Alert(Alert.AlertType.ERROR, "error while opening creation window", ButtonType.OK).setHeaderText(null);
}
return controller;
}