🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #1386

Re: ActionMap in JBuilder9

#1386
From: Craig Simmons
Date: Thu, 18 Dec 2003 15:25
59 lines
3421 bytes
I think the problem is in the ExitAction constuctor.
 Craig

"Dalibor Krleza" <dkrleza@yahoo.com> wrote in message
news:pan.2003.12.12.07.18.45.835877@yahoo.com...
: 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) {
    //Should be ExitAction instead of AbstractAction
    public ExitAction(String name,Icon icon,JFrame holder) {

:     super(name,icon);
:     this.holder=holder;
:   }
:   public void actionPerformed(ActionEvent e) {
:     holder.hide();
      //   holder.setVisible(false);  might be better
:   }
: }
:
: 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.
:
: And last: observation! My code is working good. When I run my application
: everything seems to work fine. So I think it's the problem in JBuilder's
: designer (I'm not sure...ofcourse, otherways I won't be asking these
: questions here).
:
: So how to use Actions and ActionMaps in JBuilder's designer?
: Or better, how to write my code, so that JBuilder's designer could use it.
:
: Dalibor.
Technical Details
Message-ID: <brsgse$62s$1@sparta.btinternet.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!zeus.visi.com!phobos.visi.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!tiscali!newsfeed1.ip.tiscali.net!newsfeed1.eu.ignite.net!newsr1.ipcore.viaginterkom.de!btnet-peer1!btnet-feed5!btnet!news.btopenworld.com!not-for-mail
References: <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-18 07:26:02 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!zeus.visi.com!phobos.visi.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!tiscali!newsfeed1.ip.tiscali.net!newsfeed1.eu.ignite.net!newsr1.ipcore.viaginterkom.de!btnet-peer1!btnet-feed5!btnet!news.btopenworld.com!not-for-mail
From: "Craig Simmons" <Cjs1@btinternet.com>
Newsgroups: borland.public.jbuilder.java.swing
Subject: Re: ActionMap in JBuilder9
Date: Thu, 18 Dec 2003 15:25:03 +0000 (UTC)
Organization: BT Openworld
Lines: 61
Message-ID: <brsgse$62s$1@sparta.btinternet.com>
References: <pan.2003.12.12.07.18.45.835877@yahoo.com>
Reply-To: "Craig Simmons" <Cjs1@btinternet.com>
NNTP-Posting-Host: host213-122-70-198.in-addr.btopenworld.com
X-Trace: sparta.btinternet.com 1071761103 6236 213.122.70.198 (18 Dec 2003 15:25:03 GMT)
X-Complaints-To: news-complaints@lists.btinternet.com
NNTP-Posting-Date: Thu, 18 Dec 2003 15:25:03 +0000 (UTC)
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MSMail-Priority: Normal
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165