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
b9bf3f14
Commit
b9bf3f14
authored
4 years ago
by
Leon Dieter
Browse files
Options
Downloads
Patches
Plain Diff
comments
parent
63d2c20c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/tec/letsgoing/ardublock/simulator/view/GUI.java
+17
-4
17 additions, 4 deletions
src/tec/letsgoing/ardublock/simulator/view/GUI.java
src/tec/letsgoing/ardublock/simulator/view/modules/Modul.java
+8
-0
8 additions, 0 deletions
...tec/letsgoing/ardublock/simulator/view/modules/Modul.java
with
25 additions
and
4 deletions
src/tec/letsgoing/ardublock/simulator/view/GUI.java
+
17
−
4
View file @
b9bf3f14
...
@@ -131,11 +131,12 @@ public class GUI extends JFrame implements Runnable, ActionListener {
...
@@ -131,11 +131,12 @@ public class GUI extends JFrame implements Runnable, ActionListener {
// this.setLocation(-1300, 0); //Mglichkeit die Renderingposition festzulegen
// this.setLocation(-1300, 0); //Mglichkeit die Renderingposition festzulegen
this
.
setVisible
(
true
);
this
.
setVisible
(
true
);
//ComponentListener wird hinzugefgt, der auf das Vergrern des Fenster reagiert und die GUI neu ldt
this
.
addComponentListener
(
new
ComponentListener
()
{
this
.
addComponentListener
(
new
ComponentListener
()
{
@Override
@Override
public
void
componentResized
(
ComponentEvent
e
)
{
public
void
componentResized
(
ComponentEvent
e
)
{
//Das Fenster soll erst dann upgedatet werden wenn eine Grennderung grer 30 statt
e
gefunden hat
//Das Fenster soll erst dann upgedatet werden wenn eine Grennderung grer 30 stattgefunden hat
//um zu verhindern dass die update Funktion durch ein zu hufiges Aufrufen das Programm aufhngt.
//um zu verhindern dass die update Funktion durch ein zu hufiges Aufrufen das Programm aufhngt.
if
(
Math
.
abs
(
WindowHeight
-
getHeight
())
>
30
||
Math
.
abs
(
WindowWidth
-
getWidth
())
>
30
)
{
if
(
Math
.
abs
(
WindowHeight
-
getHeight
())
>
30
||
Math
.
abs
(
WindowWidth
-
getWidth
())
>
30
)
{
...
@@ -144,7 +145,7 @@ public class GUI extends JFrame implements Runnable, ActionListener {
...
@@ -144,7 +145,7 @@ public class GUI extends JFrame implements Runnable, ActionListener {
topPanelWidth
=
topPanel
.
getWidth
();
topPanelWidth
=
topPanel
.
getWidth
();
topPanelHeight
=
topPanel
.
getHeight
();
topPanelHeight
=
topPanel
.
getHeight
();
//GUI wird nur
quadratisch
skaliert mit den Gren des kleineren Seitenverhtlnisses
//GUI wird nur
gleichmig
skaliert mit den Gren des kleineren Seitenverhtlnisses
if
(
topPanelWidth
<=
topPanelHeight
)
{
if
(
topPanelWidth
<=
topPanelHeight
)
{
xscale
=
topPanelWidth
;
xscale
=
topPanelWidth
;
yscale
=
topPanelWidth
;
yscale
=
topPanelWidth
;
...
@@ -154,7 +155,7 @@ public class GUI extends JFrame implements Runnable, ActionListener {
...
@@ -154,7 +155,7 @@ public class GUI extends JFrame implements Runnable, ActionListener {
yscale
=
topPanelHeight
;
yscale
=
topPanelHeight
;
}
}
//GUI wird
mit den aktuellen Seitenverhltnissen
upgedatet
//GUI wird upgedatet
updateGUI
(
xscale
,
yscale
);
updateGUI
(
xscale
,
yscale
);
...
@@ -185,7 +186,13 @@ public class GUI extends JFrame implements Runnable, ActionListener {
...
@@ -185,7 +186,13 @@ public class GUI extends JFrame implements Runnable, ActionListener {
}
}
/**
* Die Funktion wird aufgerufen wenn sich die Fenstergre gendert hat um den Inhalt zu skalieren
* @param xscale
* Fenstergre in x
* @param yscale
* Fenstergre in y
*/
public
void
updateGUI
(
int
xscale
,
int
yscale
)
{
public
void
updateGUI
(
int
xscale
,
int
yscale
)
{
...
@@ -292,6 +299,12 @@ public class GUI extends JFrame implements Runnable, ActionListener {
...
@@ -292,6 +299,12 @@ public class GUI extends JFrame implements Runnable, ActionListener {
return
panel
;
return
panel
;
}
}
/**
* Funktion wird aufgerufen wenn GUI upgedatet wird um das Seriallog anzupassen.
* @param size
* Aktuelle Gre Fenster in y
*/
public
void
updateSerialLog
(
int
size
)
{
public
void
updateSerialLog
(
int
size
)
{
...
...
This diff is collapsed.
Click to expand it.
src/tec/letsgoing/ardublock/simulator/view/modules/Modul.java
+
8
−
0
View file @
b9bf3f14
...
@@ -57,6 +57,14 @@ public abstract class Modul implements Observer {
...
@@ -57,6 +57,14 @@ public abstract class Modul implements Observer {
public
abstract
void
updateModul
(
Pin
pin
);
public
abstract
void
updateModul
(
Pin
pin
);
/**
* Funktion wird aufgerufen wenn sich die Gre des aktuellen Fensters ndert
* @param xscale
* Fenstergre in x
* @param yscale
* Fenstergre in y
*/
public
abstract
void
updateGUI
(
int
xscale
,
int
yscale
);
public
abstract
void
updateGUI
(
int
xscale
,
int
yscale
);
public
void
addPin
(
Pin
_pin
)
{
public
void
addPin
(
Pin
_pin
)
{
...
...
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