Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sem2-formative
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jack.webb
sem2-formative
Commits
5e6c9f45
Commit
5e6c9f45
authored
Feb 26, 2018
by
jackw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bounce
parents
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
0 deletions
+79
-0
.classpath
.classpath
+6
-0
.gitignore
.gitignore
+1
-0
.project
.project
+17
-0
Bounce.java
src/Bounce.java
+55
-0
No files found.
.classpath
0 → 100644
View file @
5e6c9f45
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry
kind=
"src"
path=
"src"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER"
/>
<classpathentry
kind=
"output"
path=
"bin"
/>
</classpath>
.gitignore
0 → 100644
View file @
5e6c9f45
/bin/
.project
0 → 100644
View file @
5e6c9f45
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
sem2-formative-
</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>
org.eclipse.jdt.core.javabuilder
</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>
org.eclipse.jdt.core.javanature
</nature>
</natures>
</projectDescription>
src/Bounce.java
0 → 100644
View file @
5e6c9f45
import
javafx.application.*
;
import
javafx.event.ActionEvent
;
import
javafx.event.EventHandler
;
import
javafx.geometry.Bounds
;
import
javafx.stage.*
;
import
javafx.util.Duration
;
import
javafx.scene.*
;
import
javafx.scene.paint.*
;
import
javafx.scene.canvas.*
;
import
javafx.scene.shape.*
;
import
javafx.animation.*
;
import
java.util.*
;
public
class
Bounce
extends
Application
{
public
void
setup
()
{
}
public
void
start
(
Stage
s
)
{
Canvas
canvas
=
new
Canvas
();
Group
root
=
new
Group
();
Scene
scene
=
new
Scene
(
root
,
700
,
700
,
Color
.
LIGHTGREY
);
Circle
ball
=
new
Circle
(
20
,
Color
.
GREEN
);
ball
.
relocate
(
100
,
50
);
root
.
getChildren
().
add
(
ball
);
root
.
getChildren
().
add
(
canvas
);
s
.
setScene
(
scene
);
s
.
setTitle
(
"Bounce"
);
s
.
show
();
setup
();
Timeline
timeline
=
new
Timeline
(
new
KeyFrame
(
Duration
.
millis
(
20
),
new
EventHandler
<
ActionEvent
>()
{
// Change millis for speed of the ball
double
dx
=
7
;
double
dy
=
3
;
@Override
public
void
handle
(
ActionEvent
t
)
{
// move the ball
ball
.
setLayoutX
(
ball
.
getLayoutX
()
+
dx
);
ball
.
setLayoutY
(
ball
.
getLayoutY
()
+
dy
);
//Make ball notice edge of screen and change direction.
}
}));
timeline
.
setCycleCount
(
Timeline
.
INDEFINITE
);
timeline
.
play
();
}
public
static
void
main
(
String
[]
args
)
{
launch
(
args
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment