I'm starting to enjoy JavaFX ^.^

This commit is contained in:
2023-08-26 02:09:47 -05:00
parent 986aa47cec
commit 82ccc27d9f
529 changed files with 6552 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
#Wed, 23 Aug 2023 13:31:30 -0500
#Wed, 23 Aug 2023 15:38:52 -0500
/home/caleb/ASDV-WebDev/Semester\ 2/lab3_CalebFontenot=
/home/caleb/ASDV-Java/Semester\ 3/Assignments/lab3_CalebFontenot=

View File

@@ -1,4 +1,11 @@
auxiliary.org-netbeans-modules-projectapi.issue214819_5f_fx_5f_enabled=true
compile.on.save=true
do.depend=false
do.jar=true
do.jlink=false
# No need to modify this property unless customizing JavaFX Ant task infrastructure
endorsed.javafx.ant.classpath=.
javac.debug=true
javadoc.preview=true
jlink.strip=false
user.properties.file=/home/caleb/.netbeans/18/build.properties

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
</open-files>
</project-private>

View File

@@ -1,6 +1,5 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
@@ -42,6 +41,7 @@ javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=false
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
@@ -58,6 +58,7 @@ javac.test.processorpath=\
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
@@ -93,6 +94,8 @@ javafx.preloader.type=none
javafx.rebase.libs=false
javafx.run.height=600
javafx.run.width=800
jlink.launcher=false
jlink.launcher.name=lab3_CalebFontenot
# Pre-JavaFX 2.0 WebStart is deactivated in JavaFX 2.0+ projects
jnlp.enabled=false
# Main class for Java launcher
@@ -103,7 +106,8 @@ manifest.custom.codebase=*
manifest.custom.permissions=
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
platform.active=JDK_1.8
mkdist.disabled=false
platform.active=JDK_8__System_
run.classpath=\
${dist.jar}:\
${javac.classpath}:\

View File

@@ -7,6 +7,7 @@ package lab3_calebfontenot;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.input.KeyCode;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;
@@ -17,8 +18,7 @@ import javafx.stage.Stage;
public class BallControl extends Application {
@Override
public void start(Stage primaryStage) throws Exception
{
public void start(Stage primaryStage) throws Exception {
BouncingBall bouncingBall = new BouncingBall();
// Create a scene and place it in the stage
Scene scene = new Scene(bouncingBall, 800, 600);
@@ -26,32 +26,35 @@ public class BallControl extends Application {
primaryStage.setScene(scene);
primaryStage.show();
bouncingBall.requestFocus();
bouncingBall.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event)
{
public void handle(MouseEvent event) {
bouncingBall.pause();
}
});
bouncingBall.setOnMouseReleased(e ->
{
bouncingBall.setOnMouseReleased(e
-> {
bouncingBall.play();
});
}
// Increase and decrease animation
bouncingBall.setOnKeyPressed(e ->
{
if (e.getCode() == KeyCode.UP) {
bouncingBall.setOnKeyPressed (e
-> {
if (e.getCode() == KeyCode.UP) {
bouncingBall.increaseSpeed();
} else if (e.getCode() == KeyCode.DOWN) {
bouncingBall.decreaseSpeed();
}
});
public static void main(String[] args)
{
}
);
}
public static void main(String[] args) {
launch(args);
}
}

View File

@@ -71,10 +71,12 @@ public void pause() {
public void increaseSpeed() {
animation.setRate(animation.getRate() * 1.5);
System.out.println(animation.getRate());
}
public void decreaseSpeed() {
animation.setRate(animation.getRate() * 1.5 > 0 ? animation.getRate() / 1.5 : 0);
System.out.println(animation.getRate());
}
public DoubleProperty rateProperty() {