Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OpticalSignaling
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Savage
OpticalSignaling
Commits
e383b4c4
Commit
e383b4c4
authored
7 years ago
by
J. M. Bailey
Browse files
Options
Downloads
Patches
Plain Diff
Save image window preferences
parent
d971bd90
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
OpticalSignalingCommsToolbox/src/main/java/edu/nps/moves/qrtda/elements/gui/ImageProjectorPanel.java
+30
-4
30 additions, 4 deletions
...edu/nps/moves/qrtda/elements/gui/ImageProjectorPanel.java
with
30 additions
and
4 deletions
OpticalSignalingCommsToolbox/src/main/java/edu/nps/moves/qrtda/elements/gui/ImageProjectorPanel.java
+
30
−
4
View file @
e383b4c4
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
package
edu.nps.moves.qrtda.elements.gui
;
package
edu.nps.moves.qrtda.elements.gui
;
import
edu.nps.moves.misc.StretchIcon
;
import
edu.nps.moves.misc.StretchIcon
;
import
edu.nps.moves.qrtda.QRPreferences
;
import
edu.nps.moves.qrtda.TdaEnvironment
;
import
edu.nps.moves.qrtda.TdaEnvironment
;
import
edu.nps.moves.qrtda.elements.misc.NameDefault
;
import
edu.nps.moves.qrtda.elements.misc.NameDefault
;
import
edu.nps.moves.qrtda.elements.misc.QrtdaParameter
;
import
edu.nps.moves.qrtda.elements.misc.QrtdaParameter
;
...
@@ -159,6 +160,10 @@ public class ImageProjectorPanel extends JPanel
...
@@ -159,6 +160,10 @@ public class ImageProjectorPanel extends JPanel
public
class
ImageProjectorWin
extends
JFrame
public
class
ImageProjectorWin
extends
JFrame
{
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
public
final
static
String
IMAGEPROJECTOR_WIN_X_PREF
=
"ImageProjector_Win_X"
;
public
final
static
String
IMAGEPROJECTOR_WIN_Y_PREF
=
"ImageProjector_Win_Y"
;
public
final
static
String
IMAGEPROJECTOR_WIN_W_PREF
=
"ImageProjector_Win_W"
;
public
final
static
String
IMAGEPROJECTOR_WIN_H_PREF
=
"ImageProjector_Win_H"
;
BufferedImage
img
;
BufferedImage
img
;
JLabel
imgLab
;
JLabel
imgLab
;
...
@@ -169,15 +174,23 @@ public class ImageProjectorPanel extends JPanel
...
@@ -169,15 +174,23 @@ public class ImageProjectorPanel extends JPanel
super
.
setTitle
(
"Image Projector"
);
super
.
setTitle
(
"Image Projector"
);
JFrame
.
setDefaultLookAndFeelDecorated
(
false
);
JFrame
.
setDefaultLookAndFeelDecorated
(
false
);
this
.
full
=
full
;
this
.
full
=
full
;
Rectangle
bounds
=
conf
.
getBounds
();
super
.
setLocation
(
bounds
.
x
,
bounds
.
y
);
QRPreferences
prefs
=
QRPreferences
.
getInstance
();
//Rectangle bounds = conf.getBounds();
// super.setLocation(bounds.x, bounds.y);
super
.
setLocation
(
Integer
.
parseInt
(
prefs
.
get
(
IMAGEPROJECTOR_WIN_X_PREF
,
"0"
)),
Integer
.
parseInt
(
prefs
.
get
(
IMAGEPROJECTOR_WIN_Y_PREF
,
"0"
)));
super
.
getContentPane
().
setBackground
(
Color
.
black
);
super
.
getContentPane
().
setBackground
(
Color
.
black
);
if
(
full
)
{
if
(
full
)
{
super
.
setUndecorated
(
true
);
super
.
setUndecorated
(
true
);
super
.
setExtendedState
(
JFrame
.
MAXIMIZED_BOTH
);
super
.
setExtendedState
(
JFrame
.
MAXIMIZED_BOTH
);
}
}
else
else
super
.
setSize
(
600
,
600
);
//super.setSize(600, 600);
super
.
setSize
(
Integer
.
parseInt
(
prefs
.
get
(
IMAGEPROJECTOR_WIN_W_PREF
,
"600"
)),
Integer
.
parseInt
(
prefs
.
get
(
IMAGEPROJECTOR_WIN_H_PREF
,
"600"
)));
super
.
setDefaultCloseOperation
(
JFrame
.
HIDE_ON_CLOSE
);
super
.
setDefaultCloseOperation
(
JFrame
.
HIDE_ON_CLOSE
);
super
.
addWindowListener
(
new
WindowAdapter
()
super
.
addWindowListener
(
new
WindowAdapter
()
...
@@ -189,12 +202,25 @@ public class ImageProjectorPanel extends JPanel
...
@@ -189,12 +202,25 @@ public class ImageProjectorPanel extends JPanel
closeButt
.
setEnabled
(
false
);
closeButt
.
setEnabled
(
false
);
}
}
});
});
// Want to adjust image on frame resize
// Want to adjust image on frame resize
and save position and size
super
.
addComponentListener
(
new
ComponentAdapter
()
super
.
addComponentListener
(
new
ComponentAdapter
()
{
{
@Override
public
void
componentMoved
(
ComponentEvent
e
)
{
QRPreferences
prefs
=
QRPreferences
.
getInstance
();
Rectangle
rect
=
ImageProjectorWin
.
this
.
getBounds
();
prefs
.
put
(
IMAGEPROJECTOR_WIN_X_PREF
,
""
+
rect
.
x
);
prefs
.
put
(
IMAGEPROJECTOR_WIN_Y_PREF
,
""
+
rect
.
y
);
}
@Override
@Override
public
void
componentResized
(
ComponentEvent
e
)
public
void
componentResized
(
ComponentEvent
e
)
{
{
QRPreferences
prefs
=
QRPreferences
.
getInstance
();
Dimension
dim
=
ImageProjectorWin
.
this
.
getSize
();
prefs
.
put
(
IMAGEPROJECTOR_WIN_W_PREF
,
""
+
dim
.
width
);
prefs
.
put
(
IMAGEPROJECTOR_WIN_H_PREF
,
""
+
dim
.
height
);
if
(
img
!=
null
)
if
(
img
!=
null
)
setImage
(
img
);
setImage
(
img
);
}
}
...
...
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