🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.swing
12 messages
12 total messages Started by Dalibor Krleza Fri, 12 Dec 2003 07:18
ActionMap in JBuilder9
#1489
Author: 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.
Re: ActionMap in JBuilder9
#1386
Author: 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.
Re: ActionMap in JBuilder9
#1396
Author: John McGrath [TeamB]
Date: Fri, 19 Dec 2003 05:26
14 lines
1314 bytes
On 12/12/2003 at 2:18:46 AM, Dalibor Krleza wrote:

> So how to use Actions and ActionMaps in JBuilder's designer?

The UI Designer does not have any facility for editing ActionMaps.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Re: ActionMap in JBuilder9
#1398
Author: Dalibor Krleza
Date: Fri, 19 Dec 2003 07:41
17 lines
1759 bytes
On Thu, 18 Dec 2003 22:26:33 -0700, John McGrath  [TeamB] wrote:

> On 12/12/2003 at 2:18:46 AM, Dalibor Krleza wrote:
> 
>> So how to use Actions and ActionMaps in JBuilder's designer?
> 
> The UI Designer does not have any facility for editing ActionMaps.

I wasn't talking about editing ActionMaps. Did you actually read my post?
I think you have automatically answer without reading and understanding my
previous post.

What about this UI Designer error? I can't work normally in designer. If 
I add this code manually, designer keeps showing this errors and any
normal work is not possible.

Dalibor.
Re: ActionMap in JBuilder9
#1399
Author: Craig Simmons
Date: Fri, 19 Dec 2003 08:39
16 lines
2063 bytes
:: What about this UI Designer error? I can't work normally in designer. If
: I add this code manually, designer keeps showing this errors and any
: normal work is not possible.

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)

The error is thrown when the designer tries to access the ExitAction
contructor which in the code posted is named incorrectly, as it can not find
the construtor it throws the exception.

See my previous post with commented code.

Craig
Re: ActionMap in JBuilder9
#1400
Author: Gillmer J. Derge (TeamB)
Date: Fri, 19 Dec 2003 14:49
10 lines
1422 bytes
"Dalibor Krleza" <dkrleza@yahoo.com> wrote in message
news:pan.2003.12.12.07.18.45.835877@yahoo.com...
> class ExitAction extends AbstractAction {
>   JFrame holder;
>   public AbstractAction(String name,Icon icon,JFrame holder) {

Shouldn't this method be called ExitAction?

-- 
Gillmer J. Derge (TeamB)
Re: ActionMap in JBuilder9
#1403
Author: Dalibor Krle�a
Date: Fri, 19 Dec 2003 18:58
25 lines
1636 bytes
> Shouldn't this method be called ExitAction?
>
> --
> Gillmer J. Derge (TeamB)

Yes, I apologize myself. I must have made this mistake while copying my
code.

It should be:

class ExitAction extends AbstractAction {
  JFrame holder;
  public ExitAction(String name,Icon icon,JFrame holder) {
    super(name,icon);
    this.holder=holder;
  }
  public void actionPerformed(ActionEvent e) {
    holder.hide();
  }
}

But even so, my problem is still present. With the mistake I have made
before I couldn't even compile my example. I repeat, example is working.

Dalibor.
Re: ActionMap in JBuilder9
#1405
Author: Craig Simmons
Date: Fri, 19 Dec 2003 21:44
36 lines
2221 bytes
see http://java.sun.com/j2se/1.3/docs/api/java/awt/Component.html#hide()

public void hide()Deprecated. As of JDK version 1.1, replaced by
setVisible(boolean).

Craig

"Dalibor Krle�a" <dkrleza@yahoo.com> wrote in message
news:3fe34a40@newsgroups.borland.com...
: > Shouldn't this method be called ExitAction?
: >
: > --
: > Gillmer J. Derge (TeamB)
:
: Yes, I apologize myself. I must have made this mistake while copying my
: code.
:
: It should be:
:
: class ExitAction extends AbstractAction {
:   JFrame holder;
:   public ExitAction(String name,Icon icon,JFrame holder) {
:     super(name,icon);
:     this.holder=holder;
:   }
:   public void actionPerformed(ActionEvent e) {
:     holder.hide();
:   }
: }
:
: But even so, my problem is still present. With the mistake I have made
: before I couldn't even compile my example. I repeat, example is working.
:
: Dalibor.
:
:
Re: ActionMap in JBuilder9
#1406
Author: John McGrath [TeamB]
Date: Sat, 20 Dec 2003 00:01
20 lines
1699 bytes
On 12/19/2003 at 2:41:08 AM, Dalibor Krleza wrote:

> I wasn't talking about editing ActionMaps. Did you actually read my
> post?  I think you have automatically answer without reading and
> understanding my previous post.

Yes, I always respond to posts without reading them.  I have found that
random answers are almost as effective as answers to the actual
question and they take so much less time.  :o)

Good luck solving your problem.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Re: ActionMap in JBuilder9
#1411
Author: Paul Furbacher
Date: Sat, 20 Dec 2003 18:19
72 lines
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.
Re: ActionMap in JBuilder9
#1412
Author: Paul Furbacher
Date: Sat, 20 Dec 2003 18:25
36 lines
1936 bytes
Paul Furbacher wrote:

> 
> 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.

I meant to write:

I've tested it in both JBuilder 9 and 10, and
it does work.


-- 


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.
Re: ActionMap in JBuilder9
#1413
Author: Dalibor Krleza
Date: Sat, 20 Dec 2003 19:25
21 lines
1600 bytes
"Paul Furbacher" <pfurbacher@mac.com> wrote in message
news:3fe492a3$1@newsgroups.borland.com...
>
> 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.

Yes it works. I tried to do this before and didn't work. Now I know why... I
didn't recompile my project. After recompiling whole project, I can connect
this Action with swing components.

Tnx a lot. Dalibor.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads