Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Simulator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
letsgoING
ArduBlock Source
Simulator
Commits
9aa2d05d
Commit
9aa2d05d
authored
4 years ago
by
Leon Dieter
Browse files
Options
Downloads
Patches
Plain Diff
SerialLog is now resizable / GUI progressed
parent
11b772f4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tec/letsgoing/ardublock/simulator/view/GUI.java
+53
-16
53 additions, 16 deletions
src/tec/letsgoing/ardublock/simulator/view/GUI.java
with
53 additions
and
16 deletions
src/tec/letsgoing/ardublock/simulator/view/GUI.java
+
53
−
16
View file @
9aa2d05d
...
@@ -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>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment