From 45c58ea37faeda4546ca957a73960a4c5bd125a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20K=C3=BChn?= Date: Thu, 20 Jan 2022 13:52:35 +0100 Subject: [PATCH] Made changeable size of svg --- client/app/src/main/java/main/MainController.java | 4 ++-- client/app/src/main/java/main/SvgBtnCreator.java | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/client/app/src/main/java/main/MainController.java b/client/app/src/main/java/main/MainController.java index c7e5b4e..cead76a 100644 --- a/client/app/src/main/java/main/MainController.java +++ b/client/app/src/main/java/main/MainController.java @@ -149,7 +149,7 @@ public class MainController { SvgBtnCreator.createPath("M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z", "white", "lightgray") ); - Button deleteBtn = SvgBtnCreator.cretaeBtn(svgDel); + Button deleteBtn = SvgBtnCreator.cretaeBtn(svgDel, 24); deleteBtn.getStyleClass().add("deleteEventBtn"); deleteBtn.setOnAction(e -> { @@ -163,7 +163,7 @@ public class MainController { SvgBtnCreator.createPath("M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z", "white", "lightgray") ); - Button editBtn = SvgBtnCreator.cretaeBtn(svgEdit); + Button editBtn = SvgBtnCreator.cretaeBtn(svgEdit, 24); editBtn.getStyleClass().add("editEventBtn"); editBtn.setOnAction(event1 -> { try { diff --git a/client/app/src/main/java/main/SvgBtnCreator.java b/client/app/src/main/java/main/SvgBtnCreator.java index cd1321e..0703d5d 100644 --- a/client/app/src/main/java/main/SvgBtnCreator.java +++ b/client/app/src/main/java/main/SvgBtnCreator.java @@ -8,9 +8,7 @@ import javafx.scene.shape.SVGPath; public class SvgBtnCreator { - private static final int SVG_SIZE = 24; - - public static Button cretaeBtn(Group group) { + public static Button cretaeBtn(Group group, int svgSize) { Button btn = new Button(); Bounds boundsDel = group.getBoundsInParent(); @@ -18,8 +16,8 @@ public class SvgBtnCreator { group.setScaleX(scaleDel); group.setScaleY(scaleDel); btn.setGraphic(group); - btn.setMaxSize(SVG_SIZE, SVG_SIZE); - btn.setMinSize(SVG_SIZE, SVG_SIZE); + btn.setMaxSize(svgSize, svgSize); + btn.setMinSize(svgSize, svgSize); btn.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); return btn;