Skip to content

Instantly share code, notes, and snippets.

james-d

Block or report user

Report or block james-d

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@james-d
james-d / LabelsWithStrikethrough.java
Created Mar 22, 2016
Demo of using CSS pseudoclasses to provide strikethrough in labels
View LabelsWithStrikethrough.java
import java.util.Arrays;
import java.util.List;
import javafx.application.Application;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.css.PseudoClass;
import javafx.scene.Scene;
import javafx.scene.control.Button;
@james-d
james-d / MockServer.java
Created Feb 18, 2016
Example of showing an alert from background thread using `Platform.runLater(...)`
View MockServer.java
import static javafx.beans.binding.Bindings.when;
import java.util.Random;
import java.util.function.Consumer;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.concurrent.Service;
import javafx.concurrent.Task;
@james-d
james-d / RectangleDrawing.java
Last active Feb 4, 2016
Demo of event handling and consuming events. Double click to add a rectangle. Selected rectangles have a gold border. Drag a rectangle to move it; drag on empty space to select.
View RectangleDrawing.java
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javafx.application.Application;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener.Change;
@james-d
james-d / ScoreTable.java
Created Jan 27, 2016
Example of table with varying number of columns according to user input
View ScoreTable.java
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.binding.IntegerBinding;
import javafx.beans.binding.ObjectBinding;
import javafx.collections.FXCollections;
View Hangman.java
package hangman;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.binding.StringBinding;
import javafx.scene.Scene;
import javafx.scene.control.Button;
@james-d
james-d / CalendarView.java
Last active Apr 1, 2018
Simple example of a calendar display. Supports some basic CSS styling and direct localization (in practice you would almost never need localization, just use the default locale; but it was fun to play with). Includes a simple example.
View CalendarView.java
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.time.format.TextStyle;
import java.time.temporal.ChronoUnit;
import java.time.temporal.WeekFields;
import java.util.Locale;
import javafx.beans.binding.Bindings;
View ParameterSettingsTable.java
import javafx.application.Application;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.ReadOnlyStringWrapper;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
import javafx.scene.Node;
import javafx.scene.Scene;
View TableWithEditingDialog.java
import java.util.List;
import java.util.Random;
import java.util.function.Function;
import java.util.regex.Pattern;
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.IntegerProperty;
View ImageToByteArray.java
import java.nio.ByteBuffer;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.PixelReader;
import javafx.scene.image.WritablePixelFormat;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
@james-d
james-d / SerializedEdgeDemo.java
Created Dec 2, 2015
Demo of how to serialize JavaFX data models containing non-serializable JavaFX properties.
View SerializedEdgeDemo.java
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
You can’t perform that action at this time.