diff --git a/resources/icons/circle.png b/resources/icons/circle.png
new file mode 100644
index 0000000..a37118b
Binary files /dev/null and b/resources/icons/circle.png differ
diff --git a/resources/icons/radio_button.png b/resources/icons/radio_button.png
new file mode 100644
index 0000000..b127035
Binary files /dev/null and b/resources/icons/radio_button.png differ
diff --git a/resources/ui.xml b/resources/ui.xml
index 34b7a76..bf800d2 100644
--- a/resources/ui.xml
+++ b/resources/ui.xml
@@ -18,9 +18,63 @@
Name="Panel"
Row="0"
Column="1">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/guiTree/Animations/SizeAnimation.java b/src/guiTree/Animations/SizeAnimation.java
new file mode 100644
index 0000000..d2c16c2
--- /dev/null
+++ b/src/guiTree/Animations/SizeAnimation.java
@@ -0,0 +1,35 @@
+package guiTree.Animations;
+
+import guiTree.Helper.Debugger;
+import guiTree.Helper.Point2;
+import guiTree.Visual;
+
+public class SizeAnimation implements AnimationInterface {
+ private Point2 from;
+ private Point2 to;
+ private Point2 offset;
+ private Visual element;
+
+ public SizeAnimation(Visual v, Point2 from, Point2 to, int ms) {
+ this.from = new Point2<>(from.x.floatValue(), from.y.floatValue());
+ this.to = to;
+ this.offset = new Point2<>((float)(to.x - from.x) * 1000 / FPS / ms, (float)(to.y - from.y) * 1000 / FPS / ms);
+ this.element = v;
+ Debugger.log("Created size animation for " + v.getName() + " from width: " + from.x + " height: " + from.y + " to width: " + to.x + " height: " + to.y, Debugger.Tag.ANIMATIONS);
+ }
+
+ @Override
+ public boolean step() {
+ if(((from.x + offset.x >= to.x && offset.x >= 0) || (from.x + offset.x <= to.x && offset.x <= 0)) &&
+ ((from.y + offset.y >= to.y && offset.y >= 0) || (from.y + offset.y <= to.y && offset.y <= 0))) {
+ element.setSize(to.x, to.y);
+ Debugger.log("Animation for " + element.getName() + " finished", Debugger.Tag.ANIMATIONS);
+ return true;
+ }
+ from.x += offset.x;
+ from.y += offset.y;
+ element.setSize(Math.round(from.x), Math.round(from.y));
+ element.update();
+ return false;
+ }
+}
diff --git a/src/guiTree/Components/Button.java b/src/guiTree/Components/Button.java
index dac8638..6d76247 100644
--- a/src/guiTree/Components/Button.java
+++ b/src/guiTree/Components/Button.java
@@ -2,6 +2,7 @@ package guiTree.Components;
import guiTree.Animations.ColorAnimation;
import guiTree.Helper.Debugger;
+import guiTree.Helper.Point2;
import guiTree.Visual;
import guiTree.events.MouseAdapter;
@@ -12,7 +13,7 @@ import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
-public class Button extends Visual {
+public class Button extends MenuItem {
private String label;
private BufferedImage icon;
private int round = -1;
@@ -140,4 +141,44 @@ public class Button extends Visual {
public BufferedImage getIcon() {
return icon;
}
+
+ @Override
+ public Point2 getClosedSize() {
+ return new Point2<>(getWidth(), getHeight());
+ }
+
+ @Override
+ public Point2 getOpenedSize() {
+ return getClosedSize();
+ }
+
+ @Override
+ public void setClosedSize(Integer width, Integer height) {
+ setSize(width, height);
+ }
+
+ @Override
+ public void setOpenedSize(Integer width, Integer height) {
+ setSize(width, height);
+ }
+
+ @Override
+ public int getClosedWidth() {
+ return getWidth();
+ }
+
+ @Override
+ public int getClosedHeight() {
+ return getHeight();
+ }
+
+ @Override
+ public int getOpenedWidth() {
+ return getWidth();
+ }
+
+ @Override
+ public int getOpenedHeight() {
+ return getHeight();
+ }
}
diff --git a/src/guiTree/Components/CheckBox.java b/src/guiTree/Components/CheckBox.java
index 19f7bed..02bc2e5 100644
--- a/src/guiTree/Components/CheckBox.java
+++ b/src/guiTree/Components/CheckBox.java
@@ -13,6 +13,7 @@ import java.io.File;
import java.io.IOException;
public class CheckBox extends Visual {
+ public static int CHECKBOX_CLICKED = 3;
private BufferedImage icon;
private boolean hovered;
private boolean marked;
@@ -45,6 +46,7 @@ public class CheckBox extends Visual {
addAnimation(new ColorAnimation(CheckBox.this, getForegroundColor(), getAccentColor(), 100));
}
marked = !marked;
+ notifyParent(CHECKBOX_CLICKED);
Debugger.log("Calling repaint from pressed: " + getName(), Debugger.Tag.PAINTING);
update();
}
@@ -76,7 +78,17 @@ public class CheckBox extends Visual {
}
public void setMarked(boolean marked) {
+ if(this.marked != marked) {
+ if (!this.marked) {
+ addAnimation(new ColorAnimation(this, getBackgroundColor(), getForegroundColor(), 100));
+ } else {
+ addAnimation(new ColorAnimation(this, getForegroundColor(), getBackgroundColor(), 100));
+ }
+ }
+
this.marked = marked;
+
+ update();
}
public String getText() {
@@ -85,10 +97,12 @@ public class CheckBox extends Visual {
public void setText(String text) {
this.text = text;
+ update();
}
public void setIcon(BufferedImage icon) {
this.icon = icon;
+ update();
}
public void setIcon(String url) {
@@ -97,6 +111,7 @@ public class CheckBox extends Visual {
} catch (IOException e) {
e.printStackTrace();
}
+ update();
}
@Override
diff --git a/src/guiTree/Components/DropDown.java b/src/guiTree/Components/DropDown.java
new file mode 100644
index 0000000..ae4cea7
--- /dev/null
+++ b/src/guiTree/Components/DropDown.java
@@ -0,0 +1,262 @@
+package guiTree.Components;
+
+import guiTree.Animations.SizeAnimation;
+import guiTree.Helper.Point2;
+import guiTree.Visual;
+import guiTree.events.MouseAdapter;
+import javafx.css.Size;
+
+import java.awt.*;
+import java.awt.event.MouseEvent;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.List;
+
+public class DropDown extends ToggleButton implements Menu{
+ private List