Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NeoSuit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Christian Wulf
NeoSuit
Commits
7be14839
Commit
7be14839
authored
9 years ago
by
Daniel Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
WIP
parent
0831b8e7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
NeoSuit/src/main/java/ui/shared/MainApp.java
+36
-2
36 additions, 2 deletions
NeoSuit/src/main/java/ui/shared/MainApp.java
NeoSuit/src/main/java/ui/shared/ModeSelectScreen.fxml
+2
-4
2 additions, 4 deletions
NeoSuit/src/main/java/ui/shared/ModeSelectScreen.fxml
with
38 additions
and
6 deletions
NeoSuit/src/main/java/ui/shared/MainApp.java
+
36
−
2
View file @
7be14839
package
ui.shared
;
import
java.io.IOException
;
import
java.util.Timer
;
import
java.util.TimerTask
;
import
javafx.application.Application
;
import
javafx.beans.value.ChangeListener
;
import
javafx.beans.value.ObservableValue
;
import
javafx.fxml.FXMLLoader
;
import
javafx.scene.Scene
;
import
javafx.scene.layout.AnchorPane
;
...
...
@@ -33,7 +37,7 @@ public class MainApp extends Application {
* Show a screen in the center of the main window
*
* @param location
* path to fxml file
* path to fxml file
(without screen)
* @return
*/
public
ConnectedControl
showScreen
(
String
location
)
{
...
...
@@ -61,8 +65,8 @@ public class MainApp extends Application {
loader
.
setLocation
(
MainApp
.
class
.
getResource
(
"RootLayout.fxml"
));
rootLayout
=
(
BorderPane
)
loader
.
load
();
// Show the scene containing the root layout.
Scene
scene
=
new
Scene
(
rootLayout
);
addResizeListener
();
primaryStage
.
setScene
(
scene
);
primaryStage
.
show
();
}
catch
(
IOException
e
)
{
...
...
@@ -70,6 +74,36 @@ public class MainApp extends Application {
}
}
private
void
addResizeListener
()
{
ChangeListener
<
Number
>
listener
=
new
ChangeListener
<
Number
>()
{
final
Timer
timer
=
new
Timer
();
// uses a timer to call your
// resize method
TimerTask
task
=
null
;
// task to execute after defined delay
final
long
delayTime
=
200
;
// delay that has to pass in order
// to consider an operation done
public
void
changed
(
ObservableValue
<?
extends
Number
>
observable
,
Number
oldValue
,
Number
newValue
)
{
if
(
task
!=
null
)
{
// there was already a task scheduled
// from the previous operation ...
task
.
cancel
();
// cancel it, we have a new size to
// consider
}
task
=
new
TimerTask
()
{
@Override
public
void
run
()
{
// here you can place your resize code
System
.
out
.
println
(
"resize to "
+
primaryStage
.
getWidth
()
+
" "
+
primaryStage
.
getHeight
());
}
};
// schedule new task
timer
.
schedule
(
task
,
delayTime
);
}
};
primaryStage
.
widthProperty
().
addListener
(
listener
);
primaryStage
.
heightProperty
().
addListener
(
listener
);
}
/**
* Returns the main stage.
*
...
...
This diff is collapsed.
Click to expand it.
NeoSuit/src/main/java/ui/shared/ModeSelectScreen.fxml
+
2
−
4
View file @
7be14839
...
...
@@ -6,11 +6,9 @@
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane
maxHeight=
"1.7976931348623157E308"
maxWidth=
"1.7976931348623157E308"
xmlns=
"http://javafx.com/javafx/8.0.40"
xmlns:fx=
"http://javafx.com/fxml/1"
fx:controller=
"ui.shared.ModeSelectScreen"
>
<AnchorPane
maxHeight=
"1.7976931348623157E308"
maxWidth=
"1.7976931348623157E308"
minHeight=
"400.0"
minWidth=
"600.0"
xmlns=
"http://javafx.com/javafx/8.0.40"
xmlns:fx=
"http://javafx.com/fxml/1"
fx:controller=
"ui.shared.ModeSelectScreen"
>
<children>
<GridPane
prefHeight=
"431.0"
pref
Width=
"
528
.0"
>
<GridPane
gridLinesVisible=
"true"
maxHeight=
"1.7976931348623157E308"
maxWidth=
"1.7976931348623157E308"
minHeight=
"400.0"
min
Width=
"
600
.0"
>
<columnConstraints>
<ColumnConstraints
hgrow=
"ALWAYS"
minWidth=
"10.0"
prefWidth=
"100.0"
/>
<ColumnConstraints
hgrow=
"ALWAYS"
minWidth=
"10.0"
prefWidth=
"100.0"
/>
...
...
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