Skip to content

Instantly share code, notes, and snippets.

@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 / MyApplicationClass.java
Last active March 30, 2022 03:47
JavaFX TreeView item dynamic loading demo with FXML.
import javafx.animation.*;
import javafx.application.Application;
import javafx.event.*;
import javafx.fxml.FXMLLoader;
import javafx.scene.*;
import javafx.scene.image.Image;
import javafx.scene.input.MouseEvent;
import javafx.stage.*;
import javafx.util.Duration;
@jewelsea
jewelsea / PngImageViewer.java
Created March 14, 2013 21:28
Small JavaFX application for viewing png files.
import java.io.File;
import java.net.MalformedURLException;
import java.util.logging.*;
import javafx.application.Application;
import javafx.beans.value.*;
import javafx.event.*;
import javafx.geometry.Bounds;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.image.*;
@jewelsea
jewelsea / StackedPanes.java
Last active September 14, 2021 22:44
Simple demo of stacking TitledPanes in a VBox.
import javafx.application.*;
import javafx.beans.value.*;
import javafx.geometry.*;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.image.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
/**
@jewelsea
jewelsea / TicTacToe.java
Created March 8, 2013 11:44
A simple Tic-Tac-Toe game in JavaFX
/**
* Copyright 2013 John Smith
*
* This file is part of Jewelsea Tic-Tac-Toe.
*
* Jewelsea Tic-Tac-Toe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@jewelsea
jewelsea / PieChartWithCustomColors.java
Created March 5, 2013 22:59
Set a custom color sequence for a JavaFX pie chart.
import javafx.application.Application;
import javafx.collections.*;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.chart.*;
public class PieChartWithCustomColors extends Application {
@Override public void start(Stage stage) {
ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList(
new PieChart.Data("Grapefruit", 13),
@jewelsea
jewelsea / DynamicallyColoredBarChartWithLabel.java
Last active January 26, 2024 14:54
Colors the the bars in a JavaFX BarChart depending upon the value of each bar's data.
import javafx.application.Application;
import javafx.beans.value.*;
import javafx.geometry.Bounds;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.chart.*;
import javafx.scene.control.Label;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.shape.*;
@jewelsea
jewelsea / OffScreenOffThreadCharts.java
Created March 2, 2013 19:24
Render 300 charts off screen and save them to files in JavaFX.
import java.awt.image.BufferedImage;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;
import java.util.logging.*;
import javafx.application.*;
import javafx.beans.binding.*;
import javafx.beans.property.*;
import javafx.beans.value.*;
@jewelsea
jewelsea / ImagePaletteReducer.java
Created March 1, 2013 22:38
Reduce the color bit depth used within a JavaFX Image
import javafx.application.Application;
import javafx.event.*;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.image.*;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
// displays a button with a 64 color image palette and a full color palette when pressed.
@jewelsea
jewelsea / FruitsDisplay.java
Last active April 28, 2016 23:05
Sample of using a FlowPane to create styled text in JavaFX
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.image.*;
import javafx.scene.layout.*;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import java.util.*;