🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

ActionMap in JBuilder9

#1489
From: Dalibor Krleza
Date: Fri, 12 Dec 2003 07:18
50 lines
2582 bytes
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.

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: <pan.2003.12.12.07.18.45.835877@yahoo.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,fd14ebf6ca14ee30,start
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2003-12-11 23:28:05 PST
From: "Dalibor Krleza" <dkrleza@yahoo.com>
Organization: ABIT d.o.o.
Subject: ActionMap in JBuilder9
Date: Fri, 12 Dec 2003 08:18:46 +0100
User-Agent: Pan/0.13.3 (That cat's something I can't explain)
Message-ID: <pan.2003.12.12.07.18.45.835877@yahoo.com>
Newsgroups: borland.public.jbuilder.java.swing
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-2
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 195.29.164.242
X-Trace: newsgroups.borland.com 1071213301 195.29.164.242 (11 Dec 2003 23:15:01 -0700)
Lines: 50
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail