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 / Clock.java
Last active Aug 29, 2015
Java 8 Clock with convenient string bindings for "xxx ago" labels, with an example.
View Clock.java
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
View StockPriceTable.java
import java.util.Random;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import javafx.application.Application;
import javafx.beans.property.FloatProperty;
import javafx.beans.property.SimpleFloatProperty;
import javafx.beans.property.SimpleStringProperty;
View ListViewUpdate.java
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import javafx.application.Application;
import javafx.beans.Observable;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleStringProperty;
@james-d
james-d / TreeTableViewWithStyledRoot.java
Last active Aug 29, 2015
TreeTableView example with styled root node view.
View TreeTableViewWithStyledRoot.java
import java.io.File;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.util.Comparator;
import java.util.Date;
import javafx.application.Application;
import javafx.beans.property.ReadOnlyObjectWrapper;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
View HighlightNewTableRow.java
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import javafx.animation.PauseTransition;
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.binding.BooleanBinding;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.Property;
@james-d
james-d / JavaBeanPropertyAdapterTest.java
Last active Aug 29, 2015
Demo of JavaBeanPropertyAdapter
View JavaBeanPropertyAdapterTest.java
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.List;
import javafx.application.Application;
import javafx.beans.InvalidationListener;
import javafx.beans.property.StringProperty;
@james-d
james-d / AdditionTest.java
Last active Aug 29, 2015
Simple instructional example for the basics of using event-driven programming. In real life, I would improve this code with lots of binding.
View AdditionTest.java
import java.util.Random;
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
@james-d
james-d / TableViewSingleClickEditTest.java
Created Apr 17, 2015
Beginnings of a TableView example that has a more "spreadsheet-like" editing facility. Not intended to be production code, but demonstrates some ideas.
View TableViewSingleClickEditTest.java
import java.util.function.Function;
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.geometry.Pos;
@james-d
james-d / WebBrowserMultipleLoadingTest.java
Last active Aug 29, 2015
Loading multiple web pages
View WebBrowserMultipleLoadingTest.java
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.FlowPane;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
public class WebBrowserMultipleLoadingTest extends Application {
@Override
public void start(Stage primaryStage) {
@james-d
james-d / PopupFromBackgroundThreadDemo.java
Last active Aug 29, 2015
Simple example showing a popup shown from a background thread (simulating receiving messages from a server...). (No fancy UI, just showing the idea).
View PopupFromBackgroundThreadDemo.java
import java.util.Random;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
You can’t perform that action at this time.