Made changeable size of svg
This commit is contained in:
parent
83c1ae6814
commit
45c58ea37f
@ -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",
|
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")
|
"white", "lightgray")
|
||||||
);
|
);
|
||||||
Button deleteBtn = SvgBtnCreator.cretaeBtn(svgDel);
|
Button deleteBtn = SvgBtnCreator.cretaeBtn(svgDel, 24);
|
||||||
|
|
||||||
deleteBtn.getStyleClass().add("deleteEventBtn");
|
deleteBtn.getStyleClass().add("deleteEventBtn");
|
||||||
deleteBtn.setOnAction(e -> {
|
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",
|
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")
|
"white", "lightgray")
|
||||||
);
|
);
|
||||||
Button editBtn = SvgBtnCreator.cretaeBtn(svgEdit);
|
Button editBtn = SvgBtnCreator.cretaeBtn(svgEdit, 24);
|
||||||
editBtn.getStyleClass().add("editEventBtn");
|
editBtn.getStyleClass().add("editEventBtn");
|
||||||
editBtn.setOnAction(event1 -> {
|
editBtn.setOnAction(event1 -> {
|
||||||
try {
|
try {
|
||||||
|
@ -8,9 +8,7 @@ import javafx.scene.shape.SVGPath;
|
|||||||
|
|
||||||
public class SvgBtnCreator {
|
public class SvgBtnCreator {
|
||||||
|
|
||||||
private static final int SVG_SIZE = 24;
|
public static Button cretaeBtn(Group group, int svgSize) {
|
||||||
|
|
||||||
public static Button cretaeBtn(Group group) {
|
|
||||||
Button btn = new Button();
|
Button btn = new Button();
|
||||||
|
|
||||||
Bounds boundsDel = group.getBoundsInParent();
|
Bounds boundsDel = group.getBoundsInParent();
|
||||||
@ -18,8 +16,8 @@ public class SvgBtnCreator {
|
|||||||
group.setScaleX(scaleDel);
|
group.setScaleX(scaleDel);
|
||||||
group.setScaleY(scaleDel);
|
group.setScaleY(scaleDel);
|
||||||
btn.setGraphic(group);
|
btn.setGraphic(group);
|
||||||
btn.setMaxSize(SVG_SIZE, SVG_SIZE);
|
btn.setMaxSize(svgSize, svgSize);
|
||||||
btn.setMinSize(SVG_SIZE, SVG_SIZE);
|
btn.setMinSize(svgSize, svgSize);
|
||||||
btn.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
|
btn.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
|
||||||
|
|
||||||
return btn;
|
return btn;
|
||||||
|
Loading…
Reference in New Issue
Block a user