Article View: borland.public.jbuilder.java.swing
Article #1411Re: ActionMap in JBuilder9
From: Paul Furbacher
Date: Sat, 20 Dec 2003 18:19
Date: Sat, 20 Dec 2003 18:19
72 lines
3220 bytes
3220 bytes
I had no problem with your example as long
as the "ExitAction" class was declared
in its own file as (_public_ for emphasis here):
_public_ class ExitAction extends ... {
...
}
The Designer only balks when you omit the _public_
modifier.
Again, I tested this out in JBuilder X and it does work.
Dalibor Krleza wrote:
> Hello!
>
> Well I don't know how to use ActionMaps in/with JBuilder9 designer. When I
> want to add ActionMap manually, I get some strange errors when trying to
> connect Action with (for example) JButton or JMenu item.
>
> My code looks like
>
> public class MyFrame extends JFrame {
> ...
> Icon exit_icon=new
> ImageIcon(ClassLoader.getSystemResource("com/my_company/res/exit.gif"));
> ActionMap my_actionmap=new ActionMap();
> Action exit_action=new ExitAction("Exit",exit_icon,this);
> ...
> }
>
> class ExitAction extends AbstractAction {
> JFrame holder;
> public AbstractAction(String name,Icon icon,JFrame holder) {
> super(name,icon);
> this.holder=holder;
> }
> public void actionPerformed(ActionEvent e) {
> holder.hide();
> }
> }
>
> I can connect my ActionMap my_actionmap to JButton I have placed on frame,
> but when trying to do the same with Action, I allwas get designer error
> message:
>
> java.lang.IllegalAccessException:
> Class com.borland.jbuilder.cmt.jb.JbValue can not access a member of class
> com.my_company.MyFrame with modifiers "public" new ExitAction("Exit",
> exit_icon,this)
>
> Next: In despaire, I have isolated class ExitAction and made completely
> new class in completely new file in exactly same directory/package as my
> frame. Same result.
--
Paul Furbacher (TeamB)
Save time, search the archives:
http://www.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.
Technical Details
Message-ID:
<3fe492a3$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!newspeer1.nwr.nac.net!newsfeed.wirehub.nl!news.kweb.on.ca!newsgroups.borland.com!not-for-mailReferences:
<pan.2003.12.12.07.18.45.835877@yahoo.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,fd14ebf6ca14ee30 X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2003-12-20 10:31:52 PST Date: Sat, 20 Dec 2003 13:19:16 -0500 From: Paul Furbacher <pfurbacher@mac.com> User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: Re: ActionMap in JBuilder9 References: <pan.2003.12.12.07.18.45.835877@yahoo.com> In-Reply-To: <pan.2003.12.12.07.18.45.835877@yahoo.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 68.39.103.120 Message-ID: <3fe492a3$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1071944355 68.39.103.120 (20 Dec 2003 10:19:15 -0700) Lines: 73 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!newspeer1.nwr.nac.net!newsfeed.wirehub.nl!news.kweb.on.ca!newsgroups.borland.com!not-for-mail