Skip to content

Instantly share code, notes, and snippets.

View TextAreaTableCell.java
import javafx.beans.binding.Bindings;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.control.Cell;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TextArea;
import javafx.scene.input.KeyCode;
import javafx.util.Callback;
import javafx.util.StringConverter;
View SelectionModelBidirectionalBinding.java
public class SelectionModelBidirectionalBinding<T> implements ChangeListener<T>, WeakListener {
private final WeakReference<Property<T>> propertyRef1;
private final WeakReference<SelectionModel<T>> propertyRef2;
private boolean updating = false;
private final int cachedHashCode;
public SelectionModelBidirectionalBinding(Property<T> property1, SelectionModel<T> property2) {
cachedHashCode = property1.hashCode() * property2.hashCode();
propertyRef1 = new WeakReference<>(property1);
propertyRef2 = new WeakReference<>(property2);
View ResizableGrid.java
public class ResizableGrid extends Pane {
// This is to make the stroke be drawn 'on pixel'.
private static final double HALF_PIXEL_OFFSET = -0.5;
private final Canvas canvas = new Canvas();
private boolean needsLayout = false;
private final StyleableObjectProperty<Paint> gridColor = new StyleableObjectProperty<Paint>(
Color.rgb(222, 248, 255)) {