Skip to content

Instantly share code, notes, and snippets.

@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 / LabeledProgressBarSample.java
Last active November 19, 2020 10:17
Sample of overlaying a text label indicating progress on top of a JavaFX ProgressBar.
import javafx.animation.*;
import javafx.application.Application;
import javafx.beans.property.*;
import javafx.beans.value.*;
import javafx.event.*;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.text.Text;
@jewelsea
jewelsea / Calc.java
Last active September 9, 2024 02:36
A simple JavaFX calculator
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.property.*;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.*;
import javafx.stage.*;
@jewelsea
jewelsea / TableViewPropertyEditor.java
Created December 13, 2012 18:12
Basic outline for a TableView based JavaFX property editor
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 / FruitComboController.java
Created December 12, 2012 10:33
JRuby + JavaFX with FXML demonstration
package org.jewelsea.examples.jruby.fruit;
import javafx.fxml.FXML;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
/** JavaFX fxml controller for fruit combo fxml demo application. */
public class FruitComboController {
@jewelsea
jewelsea / ChartGrid.java
Created December 12, 2012 02:28
JavaFX sample of a 4x4 grid of charts which, on click, explode to fill the grid and implode to return their original position.
import javafx.animation.*;
import javafx.application.Application;
import javafx.beans.property.*;
import javafx.event.*;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.chart.*;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import javafx.stage.Stage;
@jewelsea
jewelsea / TickTock.java
Created December 1, 2012 23:24
JavaFX metronome with start/stop and tempo controls.
import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ChangeListener;
@jewelsea
jewelsea / TabulatedLineChartWithLegend.java
Created November 15, 2012 22:00
Sample of a Chart with an attached table displaying chart values and a legend
import java.util.Random;
import javafx.application.Application;
import javafx.beans.property.*;
import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableList;
import javafx.geometry.*;
import javafx.scene.*;
import javafx.scene.chart.*;
import javafx.scene.chart.XYChart.Data;
import javafx.scene.chart.XYChart.Series;
@jewelsea
jewelsea / ButtonsInTabArea.java
Created September 12, 2012 19:20
Various methods of laying out buttons in association with JavaFX TabPanes
import javafx.application.Application;
import javafx.event.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
/** https://forums.oracle.com/forums/thread.jspa?messageID=10573836 "Thread: Adding button next to tab " */
@jewelsea
jewelsea / LayeredXyChartsSample.java
Created September 7, 2012 19:25
Uses JavaFX to draw layers of XYCharts.
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.scene.Scene;
import javafx.scene.chart.BarChart;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;