From 8c45dda66cf5f37066f02c22ceb36509d0ac35c2 Mon Sep 17 00:00:00 2001 From: syeyoung <42869671+cyoung06@users.noreply.github.com> Date: Tue, 24 Nov 2020 16:15:00 +0900 Subject: save and edit generic roomdata --- .../roomedit/elements/MLabelAndElement.java | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabelAndElement.java (limited to 'src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabelAndElement.java') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabelAndElement.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabelAndElement.java new file mode 100644 index 00000000..65d23bf2 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabelAndElement.java @@ -0,0 +1,32 @@ +package kr.syeyoung.dungeonsguide.roomedit.elements; + +import kr.syeyoung.dungeonsguide.roomedit.MPanel; + +import java.awt.*; + +public class MLabelAndElement extends MPanel { + private MLabel label; + private MPanel element; + + public MLabelAndElement(String label, MPanel element) { + this.add(this.label = new MLabel()); + this.label.setText(label); + this.add(element); + this.element = element; + } + + @Override + public void resize(int parentWidth, int parentHeight) { + this.setSize(new Dimension(parentWidth, bounds.height)); + label.setBounds(new Rectangle(0,0,parentHeight / 3, bounds.height)); + element.setBounds(new Rectangle(parentWidth / 3,0,parentWidth / 3 * 2, bounds.height)); + } + + @Override + public void setBounds(Rectangle bounds) { + super.setBounds(bounds); + + label.setBounds(new Rectangle(0,0,bounds.width / 3, bounds.height)); + element.setBounds(new Rectangle(bounds.width / 3,0,bounds.width / 3 * 2, bounds.height)); + } +} -- cgit