From f34737bd301f7c1a81f9ce7145c141fa3189e006 Mon Sep 17 00:00:00 2001 From: pp Date: Thu, 4 Nov 2021 12:58:28 +0100 Subject: [PATCH] =?UTF-8?q?A=20rudak=20pozicion=C3=A1l=C3=A1sa=20=C3=A9s?= =?UTF-8?q?=20az=20els=C5=91=20r=C3=BAdon=20l=C3=A9v=C5=91=20korongok=20ki?= =?UTF-8?q?rajzol=C3=A1sa.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hanoi/HanoiFormController.java | 35 ++++++++++++++++++++++++++++-- src/hanoi/Rud.java | 5 +++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/hanoi/HanoiFormController.java b/src/hanoi/HanoiFormController.java index 20070bc..1abaaa5 100644 --- a/src/hanoi/HanoiFormController.java +++ b/src/hanoi/HanoiFormController.java @@ -69,7 +69,8 @@ public class HanoiFormController { for (int i = 0; i < korongokSzama; i++) { Korong k = new Korong(szinek[i], korongSzelMax-i*KDIFF, korongMag); /* - * Rectangle tlap = k.getTlap(); tlap.setLayoutX(0); + * Rectangle tlap = k.getTlap(); + * tlap.setLayoutX(0); * tlap.setLayoutY(i*30+100); * jatekTerulet.getChildren().add(tlap); */ @@ -79,7 +80,37 @@ public class HanoiFormController { } private void rudRajzolas() { - + double x = jatekTerulet.getWidth(); + double y = jatekTerulet.getHeight(); + double w = x*0.02; + double rx1 = x/4-w/2; + double ry1 = y/3; + double rx2 = rx1+x/4; + double ry2 = ry1; + double rx3 = rx2+x/4; + double ry3 = ry1; + double rh = y-15-ry1; + elsoRudRect.setLayoutX(rx1); + elsoRudRect.setLayoutY(ry1); + elsoRudRect.setWidth(w); + elsoRudRect.setHeight(rh); + masodikRudRect.setLayoutX(rx2); + masodikRudRect.setLayoutY(ry2); + masodikRudRect.setWidth(w); + masodikRudRect.setHeight(rh); + harmadikRudRect.setLayoutX(rx3); + harmadikRudRect.setLayoutY(ry3); + harmadikRudRect.setWidth(w); + harmadikRudRect.setHeight(rh); + for (int kix=0; kix < r1.getKorongok().size(); kix++) { + Korong k = r1.getKorongok().get(kix); + double kx = rx1-(k.getSzelesseg()/2-w/2); + double ky = (y-15)-((kix+1)*k.getMagassag()); + Rectangle tlap = k.getTlap(); + tlap.setLayoutX(kx); + tlap.setLayoutY(ky); + jatekTerulet.getChildren().add(tlap); + } } diff --git a/src/hanoi/Rud.java b/src/hanoi/Rud.java index 67bd69c..e446ef9 100644 --- a/src/hanoi/Rud.java +++ b/src/hanoi/Rud.java @@ -67,6 +67,11 @@ public class Rud { public void setTlap(Rectangle tlap) { this.tlap = tlap; } + + public ArrayList getKorongok() { + return korongok; + } +