From 1b14e32589adc6c4fe62200ed244d62d638d1b7a Mon Sep 17 00:00:00 2001 From: pp Date: Thu, 21 Oct 2021 12:58:10 +0200 Subject: [PATCH] =?UTF-8?q?Koronggener=C3=A1l=C3=A1s=20k=C3=A9sz.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hanoi/HanoiFormController.java | 21 +++++++++++++++++---- src/hanoi/Korong.java | 1 + src/hanoi/Rud.java | 8 ++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/hanoi/HanoiFormController.java b/src/hanoi/HanoiFormController.java index 5094fc2..20070bc 100644 --- a/src/hanoi/HanoiFormController.java +++ b/src/hanoi/HanoiFormController.java @@ -65,10 +65,21 @@ public class HanoiFormController { private void korongGeneralas() { //System.out.println(jatekTerulet.widthProperty()); - korongSzelMax = jatekTerulet.getWidth()/3-2*KDIFF; + korongSzelMax = jatekTerulet.getWidth()/3-KDIFF; for (int i = 0; i < korongokSzama; i++) { - + Korong k = new Korong(szinek[i], korongSzelMax-i*KDIFF, korongMag); + /* + * Rectangle tlap = k.getTlap(); tlap.setLayoutX(0); + * tlap.setLayoutY(i*30+100); + * jatekTerulet.getChildren().add(tlap); + */ + r1.addKorong(k); } + rudRajzolas(); + } + + private void rudRajzolas() { + } @@ -93,6 +104,8 @@ public class HanoiFormController { private Felhasznalo fh; private int korongokSzama; private double korongSzelMax; - final private double KDIFF = 30; - private Color[] szinek = {}; + final private double KDIFF = 14; + private double korongMag = 20; + private Color[] szinek = {Color.AQUA, Color.DARKGREY,Color.BEIGE,Color.RED,Color.GREEN, + Color.YELLOW,Color.BLACK,Color.BLUE,Color.PINK,Color.WHITE}; } diff --git a/src/hanoi/Korong.java b/src/hanoi/Korong.java index ffc71e5..d11a4e7 100644 --- a/src/hanoi/Korong.java +++ b/src/hanoi/Korong.java @@ -15,6 +15,7 @@ public class Korong { this.szin = szin; this.szelesseg = szelesseg; this.magassag = magassag; + tlap = new Rectangle(szelesseg, magassag, szin); } public Color getSzin() { diff --git a/src/hanoi/Rud.java b/src/hanoi/Rud.java index b0761fe..67bd69c 100644 --- a/src/hanoi/Rud.java +++ b/src/hanoi/Rud.java @@ -18,6 +18,7 @@ public class Rud { this.szin = szin; this.szelesseg = szelesseg; this.magassag = magassag; + korongok = new ArrayList(); } public Rud(Rectangle tlap) { @@ -26,7 +27,14 @@ public class Rud { this.szin = (Color)tlap.getFill(); this.szelesseg = tlap.getWidth(); this.magassag = tlap.getHeight(); + korongok = new ArrayList(); } + + public void addKorong(Korong k) { + //TODO ellenőrizni, hogy ne legyen nagyobb a korong a legfelsőnél + korongok.add(k); + } + public Color getSzin() { return szin;