Skip to content

Instantly share code, notes, and snippets.

@Da9el00
Da9el00 / Controller.java
Created February 15, 2021 22:09
JavaFX with Scene Builder: creating a datePicker where you can pick exactly 2 dates.
package sample;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.DateCell;
import javafx.scene.control.DatePicker;
import javafx.scene.input.MouseEvent;
@Da9el00
Da9el00 / Main.java
Last active April 2, 2021 09:24
How to access Stage from a Controllers Initialize - https://www.youtube.com/watch?v=BHLDfI30WWw&lc=Ugxam2ZTD-Vouf68Pf94AaABAg
package sample;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
public class Main extends Application {
@Da9el00
Da9el00 / Controller.java
Created April 12, 2021 17:53
Play Sound with JavaFX
package sample;
import javafx.fxml.FXML;
import javafx.scene.input.MouseEvent;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import java.io.File;
public class Controller{
@Da9el00
Da9el00 / Controller.java
Created April 15, 2021 12:11
Alarm Clock
package sample;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TextField;
import javafx.scene.text.Text;
import javafx.util.Duration;
@Da9el00
Da9el00 / Controller.java
Created April 16, 2021 12:19
Changing a drop shadow with sliders
package sample;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Slider;
import javafx.scene.shape.Polygon;
import javafx.scene.effect.DropShadow;
@Da9el00
Da9el00 / Controller.java
Created April 17, 2021 09:16
Moving rectangles
package sample;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.animation.TranslateTransition;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Color;
@Da9el00
Da9el00 / Controller.java
Created April 19, 2021 07:41
Alarm Clock - 12-hour clock
package sample;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TextField;
import javafx.scene.text.Text;
import javafx.util.Duration;
@Da9el00
Da9el00 / Controller.java
Created April 21, 2021 12:57
JavaFX snake game
package sample;
import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.input.KeyCode;
@Da9el00
Da9el00 / Controller.java
Created April 23, 2021 08:13
Snake game with JavaFX
package sample;
import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.input.KeyCode;
@Da9el00
Da9el00 / Controller.java
Created April 23, 2021 21:25
AES encryption using JAVA and JavaFX for GUI
package sample;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextField;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.security.InvalidAlgorithmParameterException;