JavaFX Event Handling with Scene Builder 🎪
Learn how to handle events in JavaFX using Scene Builder with a clear tutorial and example. #JavaFX #EventHandling

Bro Code
97.0K views • Dec 28, 2020

About this video
JavaFX Handling Events using Scene Builder tutorial example explained
#JavaFX #Event #Handling
package application;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.shape.Circle;
public class Controller {
@FXML
private Circle myCircle;
private double x;
private double y;
public void up(ActionEvent e) {
//System.out.println("UP");
myCircle.setCenterY(y-=10);
}
public void down(ActionEvent e) {
//System.out.println("DOWN");
myCircle.setCenterY(y+=10);
}
public void left(ActionEvent e) {
//System.out.println("LEFT");
myCircle.setCenterX(x-=10);
}
public void right(ActionEvent e) {
//System.out.println("RIGHT");
myCircle.setCenterX(x+=10);
}
}
Bro Code merch store 👟 :
===========================================================
https://teespring.com/stores/bro-code-5
===========================================================
music credits 🎼 :
===========================================================
Up In My Jam (All Of A Sudden) by - Kubbi https://soundcloud.com/kubbi
Creative Commons — Attribution-ShareAlike 3.0 Unported— CC BY-SA 3.0
Free Download / Stream: http://bit.ly/2JnDfCE
Music promoted by Audio Library https://youtu.be/tDexBj46oNI
===========================================================
#JavaFX #Event #Handling
package application;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.shape.Circle;
public class Controller {
@FXML
private Circle myCircle;
private double x;
private double y;
public void up(ActionEvent e) {
//System.out.println("UP");
myCircle.setCenterY(y-=10);
}
public void down(ActionEvent e) {
//System.out.println("DOWN");
myCircle.setCenterY(y+=10);
}
public void left(ActionEvent e) {
//System.out.println("LEFT");
myCircle.setCenterX(x-=10);
}
public void right(ActionEvent e) {
//System.out.println("RIGHT");
myCircle.setCenterX(x+=10);
}
}
Bro Code merch store 👟 :
===========================================================
https://teespring.com/stores/bro-code-5
===========================================================
music credits 🎼 :
===========================================================
Up In My Jam (All Of A Sudden) by - Kubbi https://soundcloud.com/kubbi
Creative Commons — Attribution-ShareAlike 3.0 Unported— CC BY-SA 3.0
Free Download / Stream: http://bit.ly/2JnDfCE
Music promoted by Audio Library https://youtu.be/tDexBj46oNI
===========================================================
Tags and Topics
Browse our collection to discover more content in these categories.
Video Information
Views
97.0K
Likes
2.8K
Duration
8:31
Published
Dec 28, 2020
User Reviews
4.7
(19) Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.