Skip to content

Instantly share code, notes, and snippets.

@ricemery
ricemery / gist:4534910
Created Jan 15, 2013
Extends JavaFx TextField to limit input to positive and negative integers.
View gist:4534910
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.EventHandler;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class IntegerTextField extends TextField {
private static final Logger logger = LoggerFactory.getLogger(IntegerTextField.class);
@ricemery
ricemery / DoubleTextField
Created Jan 15, 2013
JavaFx TextField subclass that limits input to positive and negative double values.
View DoubleTextField
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.EventHandler;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyEvent;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DoubleTextField extends TextField {
@ricemery
ricemery / AkkaEventBusExample.java
Created Nov 29, 2012
Java example on using Akka EventBus
View AkkaEventBusExample.java
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.actor.UntypedActor;
import akka.event.japi.LookupEventBus;
/**
* Java example showing the usage of a Akka {@link akka.event.japi.LookupEventBus}.
* The case below shows publishing events to two different "channels". A channel is just
* a string value carried along with the Event.