Skip to content

Instantly share code, notes, and snippets.

@jewelsea
jewelsea / ReflectionByRotation.java
Created December 6, 2011 05:56
Reflect an image in JavaFX using a 180 degree rotation about the Y Axis
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBoxBuilder;
import javafx.scene.transform.Rotate;
@jewelsea
jewelsea / FatPieChart.java
Created December 16, 2011 08:34
Sample of how to build a 3d pie chart in JavaFX, inefficient, but works.
import javafx.application.Application;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.scene.chart.PieChart;
import javafx.scene.layout.Region;
import java.util.Iterator;
import javafx.application.Application;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
@jewelsea
jewelsea / BadFooServiceApp.java
Last active December 10, 2015 16:09
Samples for returning user objects types and exception types from JavaFX service calls.
import java.util.Random;
import javafx.application.Application;
import javafx.concurrent.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.VBox;
import javafx.scene.text.TextAlignment;
@jewelsea
jewelsea / TableViewPropertyEditor.java
Created March 16, 2013 00:13
A simplistic (an incomplete) object property editor for JavaFX.
import java.lang.reflect.*;
import java.util.Arrays;
import java.util.logging.*;
import javafx.application.Application;
import javafx.beans.property.*;
import javafx.beans.value.*;
import javafx.collections.*;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.*;
@jewelsea
jewelsea / RoomReservationNavigator.java
Last active December 15, 2015 04:19
JavaFX Room Reservation system - demonstrates switching between scenes in a stage.
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.event.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
public class RoomReservationNavigator extends Application {
public static void main(String[] args) { Application.launch(args); }
@jewelsea
jewelsea / ThermostatApp.java
Last active December 16, 2015 12:08
Simulates reading a thermostat every couple of seconds and updating a label with the current temperature value.
import javafx.animation.*;
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.property.*;
import javafx.event.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.util.Duration;
@jewelsea
jewelsea / BestFitSplineDemo.java
Last active December 17, 2015 05:39
JavaFX interpolator for a line of best fit through a set of points.
import javafx.animation.*;
import javafx.application.Application;
import javafx.scene.* ;
import javafx.scene.paint.*;
import javafx.scene.shape.*;
import javafx.stage.Stage;
import javafx.util.Duration;
public class BestFitSplineDemo extends Application {
@jewelsea
jewelsea / PerspectiveMovement.java
Created May 28, 2013 22:45
Demonstrates use of a JavaFX PerspectiveTransform - toggling or morphing the transform on and off.
import javafx.animation.*;
import javafx.application.*;
import javafx.beans.value.*;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.control.ToggleButton;
import javafx.scene.effect.PerspectiveTransform;
import javafx.scene.image.*;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
@jewelsea
jewelsea / ListViewTextHighlighterWithLargeData.java
Created July 4, 2013 00:48
Variation of the ListViewTextHighlighter gist which displays a large amount of data (120 megabytes) in a searchable ListView.
import javafx.application.Application;
import javafx.beans.*;
import javafx.beans.property.*;
import javafx.collections.*;
import javafx.concurrent.Task;
import javafx.concurrent.WorkerStateEvent;
import javafx.event.*;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Scene;