Skip to content
Snippets Groups Projects
Commit 9aa2d05d authored by Leon Dieter's avatar Leon Dieter
Browse files

SerialLog is now resizable / GUI progressed

parent 11b772f4
No related branches found
No related tags found
No related merge requests found
...@@ -67,6 +67,7 @@ public class GUI extends JFrame implements Runnable, ActionListener { ...@@ -67,6 +67,7 @@ public class GUI extends JFrame implements Runnable, ActionListener {
private static int yscale= 968; private static int yscale= 968;
private JPanel modulPanel; private JPanel modulPanel;
private Container mainPane; private Container mainPane;
private int WindowHeight = 968, WindowWidth = 968, topPanelHeight, topPanelWidth, counter = 1;
/** /**
* Konstruktor der Klasse GUI * Konstruktor der Klasse GUI
...@@ -133,18 +134,33 @@ public class GUI extends JFrame implements Runnable, ActionListener { ...@@ -133,18 +134,33 @@ public class GUI extends JFrame implements Runnable, ActionListener {
this.addComponentListener(new ComponentListener() { this.addComponentListener(new ComponentListener() {
@Override @Override
public void componentResized(ComponentEvent e) { public void componentResized(ComponentEvent e) {
if(getWidth() <= getHeight()) {
xscale = getWidth();
yscale = getWidth();
}
else {
xscale = getHeight();
yscale = getHeight(); WindowHeight = getHeight();
} WindowWidth = getWidth();
if(xscale % 2 == 0 || yscale % 2 == 0) { topPanelWidth = topPanel.getWidth();
updateGUI(xscale, yscale); topPanelHeight = topPanel.getHeight();
}
if(topPanelWidth <= ((topPanelHeight + WindowHeight) / 2)) {
xscale = topPanelWidth;
yscale = topPanelWidth;
}
else {
xscale = (topPanelHeight + WindowHeight) / 2;
yscale = (topPanelHeight + WindowHeight) / 2;
}
//if(WindowWidth % 3 == 0 || WindowHeight % 3 == 0) {
updateGUI(xscale, yscale);
//}
} }
@Override @Override
...@@ -165,30 +181,34 @@ public class GUI extends JFrame implements Runnable, ActionListener { ...@@ -165,30 +181,34 @@ public class GUI extends JFrame implements Runnable, ActionListener {
} }
}); });
} }
public void updateGUI(int xscale, int yscale) { public void updateGUI(int xscale, int yscale) {
counter = 0;
modules[0].updateGUI(xscale, yscale); modules[0].updateGUI(xscale, yscale);
modules[1].updateGUI(xscale, yscale); modules[1].updateGUI(xscale, yscale);
modules[2].updateGUI(xscale, yscale); modules[2].updateGUI(xscale, yscale);
modules[3].updateGUI(xscale, yscale); modules[3].updateGUI(xscale, yscale);
updateSerialLog(WindowWidth);
} }
/** /**
* Erzeugt das Controlpanel mit den Steuerungsknöpfen * Erzeugt das Controlpanel mit den Steuerungsknöpfen
* *
* @param simu Instanz des Simulators * @param simu Instanz des Simulators
* @return JPanel mit allen Knöpfen * @return JPanel mit allen Knpfen
*/ */
private JPanel createControlPanel(Simulator simu) { private JPanel createControlPanel(Simulator simu) {
...@@ -272,6 +292,23 @@ public class GUI extends JFrame implements Runnable, ActionListener { ...@@ -272,6 +292,23 @@ public class GUI extends JFrame implements Runnable, ActionListener {
panel.add(scrollPane, BorderLayout.PAGE_END); panel.add(scrollPane, BorderLayout.PAGE_END);
return panel; return panel;
} }
public void updateSerialLog(int size) {
if(size >= 1000) {
serialLog.setRows(4); // Anzahl der Angezeigten Reihen
}
else if(size < 1000 && xscale >= 800) {
serialLog.setRows(6); // Anzahl der Angezeigten Reihen
}
else if(size < 800) {
serialLog.setRows(8); // Anzahl der Angezeigten Reihen
}
}
/** /**
* Zeichne alle Verdrahtungen, welcher über die Modulgrenzen hinausgehen.<br> * Zeichne alle Verdrahtungen, welcher über die Modulgrenzen hinausgehen.<br>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment