public void post_message(int from_id, int data) { class Bind implements Runnable { public int from_id, data; public Component subject; public void run() { subject.do_post_message(from_id, data); } } Bind pm = new Bind(); pm.from_id = from_id; pm.data = data; pm.subject = this; thread.dispatch(pm); }
public void post_marker(int from_id) { // The C++ coder wonders why Java sucks so much! // thread->dispatch(boost::bind(&Component::do_post_marker, this, from_id)); class Bind implements Runnable { public int from_id; public Component subject; public void run() { subject.do_post_marker(from_id); } } Bind pm = new Bind(); pm.from_id = from_id; pm.subject = this; thread.dispatch(pm); }