From 5811ceb90f17ff5ac89ab19d879155089acb9087 Mon Sep 17 00:00:00 2001 From: mdb Date: Thu, 20 Dec 2001 00:40:09 +0000 Subject: [PATCH] Added a convenience method for posting command events. git-svn-id: https://samskivert.googlecode.com/svn/trunk@529 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../java/com/samskivert/swing/Controller.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/projects/samskivert/src/java/com/samskivert/swing/Controller.java b/projects/samskivert/src/java/com/samskivert/swing/Controller.java index b2e9fa00..e0759f40 100644 --- a/projects/samskivert/src/java/com/samskivert/swing/Controller.java +++ b/projects/samskivert/src/java/com/samskivert/swing/Controller.java @@ -1,5 +1,5 @@ // -// $Id: Controller.java,v 1.6 2001/10/03 02:20:05 mdb Exp $ +// $Id: Controller.java,v 1.7 2001/12/20 00:40:09 mdb Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -128,7 +128,7 @@ public abstract class Controller /** * Like {@link #postAction(ActionEvent)} except that it constructs the * action event for you with the supplied source component and string - * comment. The id of the event will always be set to + * command. The id of the event will always be set to * zero. */ public static void postAction (Component source, String command) @@ -138,6 +138,19 @@ public abstract class Controller EventQueue.invokeLater(new ActionInvoker(event)); } + /** + * Like {@link #postAction(ActionEvent)} except that it constructs a + * {@link CommandEvent} with the supplied source component, string + * command and argument. + */ + public static void postAction ( + Component source, String command, Object argument) + { + // slip things onto the event queue for later + CommandEvent event = new CommandEvent(source, command, argument); + EventQueue.invokeLater(new ActionInvoker(event)); + } + /** * This class is used to dispatch action events to controllers within * the context of the AWT event dispatch mechanism.