Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Newbie: Jface and Actions
Newbie: Jface and Actions [message #439858] Mon, 19 July 2004 08:45 Go to next message
exquisitus is currently offline exquisitusFriend
Messages: 211
Registered: July 2009
Senior Member
How can I add an action to a button? I know, I can do it with menues, for
example:

myAction = new MyAction();
MenuManager mm = new MenuManager();
MenuManager fileMenu = new MenuManager("File");
mm.add(fileMenu);
fileMenu.add(myAction);

Can I do something similiar with a simple push button?
Help is appreciated!

-J
Re: Newbie: Jface and Actions [message #439863 is a reply to message #439858] Mon, 19 July 2004 09:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bram.eresmas.net

Hello,

I'm not an expert , but I would say that u have to add a SelectionListener
to the button and implement the method mouseDown. There u can place ur
Action. I'm not sure, but I think u can call the method run () of the
Action, and then, everytime that u call the mouseDown method, the run() of
the action will be performed.

Have a nice day


bram

/**************************/
exquisitus wrote:

> How can I add an action to a button? I know, I can do it with menues, for
> example:

> myAction = new MyAction();
> MenuManager mm = new MenuManager();
> MenuManager fileMenu = new MenuManager("File");
> mm.add(fileMenu);
> fileMenu.add(myAction);

> Can I do something similiar with a simple push button?
> Help is appreciated!

> -J
Re: Newbie: Jface and Actions [message #439865 is a reply to message #439863] Mon, 19 July 2004 09:46 Go to previous message
exquisitus is currently offline exquisitusFriend
Messages: 211
Registered: July 2009
Senior Member
Hi,

Calling myAction.run() was what I missed.
Thanks for your help!

-Joachim

Abraham wrote:

> Hello,

> I'm not an expert , but I would say that u have to add a SelectionListener
> to the button and implement the method mouseDown. There u can place ur
> Action. I'm not sure, but I think u can call the method run () of the
> Action, and then, everytime that u call the mouseDown method, the run() of
> the action will be performed.

> Have a nice day


> bram

> /**************************/
> exquisitus wrote:

> > How can I add an action to a button? I know, I can do it with menues, for
> > example:

> > myAction = new MyAction();
> > MenuManager mm = new MenuManager();
> > MenuManager fileMenu = new MenuManager("File");
> > mm.add(fileMenu);
> > fileMenu.add(myAction);

> > Can I do something similiar with a simple push button?
> > Help is appreciated!

> > -J
Previous Topic:Standalone SWT tutorial problem
Next Topic:problems with object contribution
Goto Forum:
  


Current Time: Tue Apr 23 17:00:28 GMT 2024

Powered by FUDForum. Page generated in 0.03799 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top