Board index » jbuilder » Setting a myAction class object to a JMenuItem from the desiner

Setting a myAction class object to a JMenuItem from the desiner


2003-07-20 07:14:53 PM
jbuilder10
Hi all,
I have develop an action class that implements AbstactAction. Is any way to
set an instance of this action to a JMenuItem from the designer? I can make
it explicitly from the code but i am afraid that it will be unreadable from
the designer. Can you give me a solution? I use JB8.
Thank you all,
Kostas
 
 

Re:Setting a myAction class object to a JMenuItem from the desiner

Dear Kostas,
You can test the following technique.
1. Declare actions as members of the frame class and create them outside the
frame constructor as anonymous classes
AbstractAction myAction = new AbstaractAction("My action name",myActionIcon)
{
public void actionPerformed(ActionEvent e) {
//place for your code
}
};
2. Open design tab, the actions are at the bottom of the structure pane. If
so you can use it in the object inspector.
Best regards,
Alexei Akimov
"Kostas" < XXXX@XXXXX.COM >сообщи?сообщила ?новостях следующе?
Quote
Hi all,
I have develop an action class that implements AbstactAction. Is any way
to
set an instance of this action to a JMenuItem from the designer? I can
make
it explicitly from the code but i am afraid that it will be unreadable
from
the designer. Can you give me a solution? I use JB8.
Thank you all,
Kostas