From 30c9069b3849bcba501e44bd0fea167000ea1e91 Mon Sep 17 00:00:00 2001
From: Leon Dieter <Leon Dieter@DESKTOP-L4JC8N4>
Date: Mon, 15 Mar 2021 17:37:41 +0100
Subject: [PATCH] minor changes

---
 .../ardublock/simulator/view/GUI.java         | 38 ++++++-------------
 1 file changed, 12 insertions(+), 26 deletions(-)

diff --git a/src/tec/letsgoing/ardublock/simulator/view/GUI.java b/src/tec/letsgoing/ardublock/simulator/view/GUI.java
index 9add0a9..554a350 100644
--- a/src/tec/letsgoing/ardublock/simulator/view/GUI.java
+++ b/src/tec/letsgoing/ardublock/simulator/view/GUI.java
@@ -67,7 +67,7 @@ public class GUI extends JFrame implements Runnable, ActionListener {
 	private int yscale = 968;
 	private JPanel modulPanel;
 	private Container mainPane;
-	private int WindowHeight = 968, WindowWidth = 968, topPanelHeight, topPanelWidth;
+	private int WindowHeight = 1000, WindowWidth = 950, topPanelHeight, topPanelWidth;
 
 	/**
 	 * Konstruktor der Klasse GUI
@@ -138,24 +138,21 @@ 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()) > 30 || Math.abs(WindowWidth - getWidth()) > 30) {
+				if(Math.abs(WindowHeight - getHeight()) > 5 || Math.abs(WindowWidth - getWidth()) > 5) {
 										
 						WindowHeight = getHeight();
 						WindowWidth = getWidth();
 						topPanelWidth = topPanel.getWidth();
 						topPanelHeight = topPanel.getHeight();
-						System.out.println("WindowWidth" + WindowWidth);
-						System.out.println("WindowHeight" + WindowHeight);
-						System.out.println("toppanelWidth" + topPanelWidth);
-						System.out.println("toppanelHeight" + topPanelHeight);
+						
 						//GUI wird nur gleichm��ig skaliert mit den Gr��en des kleineren Seitenverh�tlnisses
-						if(WindowWidth <= WindowHeight) {					
+						if(WindowWidth <= WindowHeight - 80) {					
 							xscale = WindowWidth;
 							yscale = WindowWidth;					
 						}								
 						else {						
-							xscale = WindowHeight;
-							yscale = WindowHeight;						
+							xscale = WindowHeight - 80;
+							yscale = WindowHeight - 80;						
 						}		
 						
 							//GUI wird upgedatet
@@ -164,7 +161,7 @@ public class GUI extends JFrame implements Runnable, ActionListener {
 							
 				}			
 							
-					
+				updateSerialLog(getHeight()-topPanel.getHeight());
 			}
 
 			@Override
@@ -204,8 +201,9 @@ public class GUI extends JFrame implements Runnable, ActionListener {
 		modules[2].updateGUI(xscale, yscale);
 		modules[3].updateGUI(xscale, yscale);
 		
-		updateSerialLog(WindowWidth);
-					
+		
+		
+		
 	}
 	
 	
@@ -310,20 +308,8 @@ public class GUI extends JFrame implements Runnable, ActionListener {
 	 */
 	public void updateSerialLog(int size) {
 		
-		
-		if(size >= 1000) {
-			serialLog.setRows(3); // Anzahl der Angezeigten Reihen
-		}
-		else if(size < 1000 && size >= 800) {
-			serialLog.setRows(6); // Anzahl der Angezeigten Reihen
-			
-		}
-		else if(size < 800 && size >= 600) {
-			serialLog.setRows(8); // Anzahl der Angezeigten Reihen			
-		}
-		else if(size < 600) {
-			serialLog.setRows(10); // Anzahl der Angezeigten Reihen			
-		}
+		int numRows =  Math.min(Math.max(((int)size/30), 2), 16);
+		serialLog.setRows(numRows);	
 		
 	}
 
-- 
GitLab