Skip to content

Instantly share code, notes, and snippets.

@TheItachiUchiha
TheItachiUchiha / UnselectListCell.java
Created January 30, 2018 07:34
A ListCell which can be used to unselect
private class UnselectListCell<T> extends ListCell<T> {
public UnselectListCell() {
addEventFilter(MouseEvent.MOUSE_PRESSED, event -> {
if (!isEmpty()) {
MultipleSelectionModel<T> selectionModel = getListView().getSelectionModel();
int index = getIndex();
if (selectionModel.getSelectedIndices().contains(index)) {
selectionModel.clearSelection(index);
} else {
@TheItachiUchiha
TheItachiUchiha / ShowCaseBooleanProperty.java
Created June 22, 2017 12:13
Bind Button Disable Property to ListView Selection
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
public class ShowCaseBooleanProperty extends Application {
@TheItachiUchiha
TheItachiUchiha / MaskerPaneTest.java
Created May 10, 2016 09:42
Tests the hide/show property of a MaskerPane
import javafx.application.Application;
import javafx.concurrent.Task;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import org.controlsfx.control.MaskerPane;
public class MaskerPaneTest extends Application {
@TheItachiUchiha
TheItachiUchiha / SequentialTransitionStatus.java
Created May 10, 2016 07:40
Shows a SequentialTransition which can be paused and played
import javafx.animation.FadeTransition;
import javafx.animation.PauseTransition;
import javafx.animation.SequentialTransition;
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.layout.HBox;
import javafx.scene.layout.VBox;
@TheItachiUchiha
TheItachiUchiha / Clickable.java
Last active October 11, 2015 13:58
Clickable
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Main extends Application {
@Override
@TheItachiUchiha
TheItachiUchiha / ImageInImageView.java
Created September 26, 2015 17:18
ImageInImageView
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.scene.Scene;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TextField;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
@TheItachiUchiha
TheItachiUchiha / Main.java
Created June 25, 2015 10:15
A small example which shows that MouseClick events are listened by both child and its container
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Main extends Application {
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.concurrent.Task;
import javafx.scene.Cursor;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
package slideout;
import javafx.animation.*;
import javafx.application.Application;
import javafx.event.*;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.text.Text;
@TheItachiUchiha
TheItachiUchiha / ConsumeJSON.java
Last active March 11, 2019 21:12
Consuming a Rest Service which return JSON data (requires GSON)
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.concurrent.Task;
import javafx.concurrent.WorkerStateEvent;
import javafx.event.EventHandler;
import javafx.geometry.HPos;
import javafx.geometry.Insets;