overhaul gui icons + settings

This commit is contained in:
giavaphi
2022-11-20 17:39:18 +01:00
parent bfe3fcfb79
commit e96280cd0c
18 changed files with 198 additions and 17 deletions
@@ -14,6 +14,7 @@ import javafx.fxml.FXML;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
@@ -72,6 +73,9 @@ public class CropDetailController {
@FXML
private Label spacing_label;
@FXML
private Button editTaskList_button;
@FXML
void editTaskList() {
@@ -114,6 +118,9 @@ public class CropDetailController {
} catch (HardinessZoneNotSetException | IOException e) {
throw new PlantNotFoundException();
}
setIconToButton(editTaskList_button, "editIcon.png");
setIconToButton(area_button, "areaIcon.png");
setIconToButton(location_button, "locationIcon.png");
}
private void createTaskLists(Crop crop) {
@@ -149,4 +156,17 @@ public class CropDetailController {
pests_vbox.getChildren().addAll(label, hBox);
}
}
/**
* adds icon to button
* @param button the button which get the icon
* @param iconFileName file name of icon
*/
private void setIconToButton(Button button, String iconFileName) {
Image img = new Image(String.valueOf(getClass().getResource("icons/" + iconFileName)));
ImageView imageView = new ImageView(img);
imageView.setFitHeight(20);
imageView.setPreserveRatio(true);
button.setGraphic(imageView);
}
}