Skip to content

Instantly share code, notes, and snippets.

@jewelsea
jewelsea / ClippedShadow.java
Created Aug 27, 2014
Demonstrates adding a halo effect (a drop shadow) around a translucent window.
View ClippedShadow.java
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.shape.*;
import javafx.stage.*;
import org.scenicview.ScenicView;
// Java 8 code
public class ClippedShadow extends Application {
@jewelsea
jewelsea / JavaFXTrayIconSample.java
Last active Feb 14, 2021
Demonstrate using the System Tray (AWT) to control a JavaFX application.
View JavaFXTrayIconSample.java
import javafx.application.*;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.control.Label;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.stage.*;
import javax.imageio.ImageIO;
import java.io.IOException;
@jewelsea
jewelsea / DoughnutChart.java
Last active Feb 16, 2021
Creating a Doughnut chart in JavaFX
View DoughnutChart.java
import javafx.collections.ObservableList;
import javafx.geometry.Bounds;
import javafx.scene.Node;
import javafx.scene.chart.PieChart;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
public class DoughnutChart extends PieChart {
private final Circle innerCircle;
@jewelsea
jewelsea / Frosty.java
Created Mar 25, 2014
iOS 7 style sliding glass pane prototype for JavaFX
View Frosty.java
import javafx.animation.*;
import javafx.application.Application;
import javafx.beans.property.*;
import javafx.geometry.Rectangle2D;
import javafx.scene.*;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.effect.*;
import javafx.scene.image.*;
import javafx.scene.input.ScrollEvent;
@jewelsea
jewelsea / SimpleDocking.java
Created Mar 16, 2014
Simplistic docking setup for JavaFX
View SimpleDocking.java
import javafx.application.Application;
import javafx.geometry.Orientation;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.*;
public class SimpleDocking extends Application {
public void start(final Stage stage) throws Exception {
final SplitPane rootPane = new SplitPane();
@jewelsea
jewelsea / PepsiChallenge.java
Created Feb 28, 2014
JavaFX BlendMode.DIFFERENCE sample.
View PepsiChallenge.java
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.effect.BlendMode;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
@jewelsea
jewelsea / CharacterMovement.java
Created Jan 8, 2014
JavaFX sample to move a character around a field based on key controls.
View CharacterMovement.java
import javafx.animation.AnimationTimer;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.*;
import javafx.scene.image.*;
import javafx.scene.input.KeyEvent;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
/**
@jewelsea
jewelsea / ShadowedRoundedImage.java
Last active Nov 18, 2019
Creates a JavaFX ImageView which contains an image displayed in as a rounded rectangle with a drop shadow effect.
View ShadowedRoundedImage.java
import javafx.application.Application;
import javafx.fxml.*;
import javafx.scene.*;
import javafx.scene.effect.DropShadow;
import javafx.scene.image.*;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
@jewelsea
jewelsea / Hoverboard.java
Created Dec 6, 2013
Hover over a JavaFX Label to reveal a ComboBox to change the label's text.
View Hoverboard.java
import javafx.application.Application;
import javafx.geometry.*;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
public class Hoverboard extends Application {
public class TextChooser extends StackPane {
@jewelsea
jewelsea / ListOrganizer.java
Created Dec 6, 2013
Use Drag and Drop to reorder items in a JavaFX ListView
View ListOrganizer.java
import javafx.application.Application;
import javafx.collections.*;
import javafx.geometry.*;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.image.*;
import javafx.scene.input.*;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;