Skip to content

Instantly share code, notes, and snippets.

@ricemery
ricemery / AkkaEventBusExample.java
Created November 29, 2012 18:00
Java example on using Akka EventBus
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.
@ricemery
ricemery / DoubleTextField
Created January 15, 2013 00:31
JavaFx TextField subclass that limits input to positive and negative double values.
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 / gist:4534910
Created January 15, 2013 00:34
Extends JavaFx TextField to limit input to positive and negative integers.
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);