From db1cbe71aaaacb114ba5c2301cec4bd7e5c910ed Mon Sep 17 00:00:00 2001 From: Leon Dieter <Leon Dieter@DESKTOP-L4JC8N4> Date: Wed, 17 Mar 2021 11:31:41 +0100 Subject: [PATCH] minor changes --- .../ardublock/simulator/view/GUI.java | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/tec/letsgoing/ardublock/simulator/view/GUI.java b/src/tec/letsgoing/ardublock/simulator/view/GUI.java index 7be8124..7f78e30 100644 --- a/src/tec/letsgoing/ardublock/simulator/view/GUI.java +++ b/src/tec/letsgoing/ardublock/simulator/view/GUI.java @@ -114,7 +114,7 @@ public class GUI extends JFrame implements Runnable, ActionListener { drawConnections(g); // Zeichne Verdrahtung } - + }; // Füge Module hinzu modulPanel.add(modules[0].getPane(), BorderLayout.WEST); @@ -127,9 +127,9 @@ public class GUI extends JFrame implements Runnable, ActionListener { //mainPane.add(createControlPanel(simu), BorderLayout.EAST); mainPane.add(createSerialLog(), BorderLayout.PAGE_END); //this.setSize(xscale, yscale); - this.pack(); + super.pack(); // this.setLocation(-1300, 0); //M�glichkeit die Renderingposition festzulegen - this.setVisible(true); + super.setVisible(true); //ComponentListener wird hinzugef�gt, der auf das Vergr��ern des Fenster reagiert und die GUI neu l�dt this.addComponentListener(new ComponentListener() { @@ -138,7 +138,7 @@ public class GUI extends JFrame implements Runnable, ActionListener { //Das Fenster soll erst dann upgedatet werden wenn eine Gr��en�nderung gr��er 30 stattgefunden hat //um zu verhindern dass die update Funktion durch ein zu h�ufiges Aufrufen das Programm aufh�ngt. - if((Math.abs(WindowHeight - getHeight()) > 15) || (Math.abs(WindowWidth - getWidth()) > 15)) { + if((Math.abs(WindowHeight - getHeight()) > 5) || (Math.abs(WindowWidth - getWidth()) > 5)) { WindowHeight = getHeight(); WindowWidth = getWidth(); @@ -192,20 +192,26 @@ public class GUI extends JFrame implements Runnable, ActionListener { * @param yscale * Fenstergr��e in y */ - public void updateGUI(int xscale, int yscale) { + public void updateGUI(int _xscale, int _yscale) { + + for(int i = 0; i < 4; i++) { + + modules[i].updateGUI(_xscale, _yscale); + + } + +// modules[0].updateGUI(_xscale, _yscale); +// modules[1].updateGUI(_xscale, _yscale); +// modules[2].updateGUI(_xscale, _yscale); +// modules[3].updateGUI(_xscale, _yscale); - - modules[0].updateGUI(xscale, yscale); - modules[1].updateGUI(xscale, yscale); - modules[2].updateGUI(xscale, yscale); - modules[3].updateGUI(xscale, yscale); - //updateSerialLog(getHeight()-topPanel.getHeight()); - updateSerialLog(getHeight()-topPanel.getHeight()); - System.out.println(topPanel.getHeight()); - System.out.println(modulPanel.getHeight()); + + + super.setVisible(true); + panel.setVisible(true); } @@ -312,7 +318,7 @@ public class GUI extends JFrame implements Runnable, ActionListener { */ public void updateSerialLog(int size) { - int numRows = Math.min(Math.max(((int)size/20-3), 3), 20); + int numRows = Math.min(Math.max(((int)size/20)-3, 3), 20); serialLog.setRows(numRows); System.out.println(numRows); } -- GitLab