File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Action for JMenuItem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Action for JMenuItem" Watch "Action for JMenuItem" New topic
Author

Action for JMenuItem

Mathew Mintalm
Ranch Hand

Joined: Feb 21, 2010
Posts: 103

Hello, is this possible to add Action for this component?

JMenuItem

I mean this one:



Bookmark called Html (from screen) is called: jMenuItem7

And I did something like this:



But nothing happedned.

Someone can help me? Is there any other way (or maybe its impossible)
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4640
    
    5

Recommended reading:
http://catb.org/~esr/faqs/smart-questions.html
http://mindprod.com/jgloss/sscce.html


luck, db
There are no new questions, but there may be new answers.
Mathew Mintalm
Ranch Hand

Joined: Feb 21, 2010
Posts: 103

In my opinion its well explained, what else should I post..

Simple question, is therey any way to add action for JMenuItem

This one.. :



.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2200
    
    7
In my opinion its well explained,


No it is not well explained. A JMenuItem is typically added to a JMenu, but your picture looks more like a tabbed pane. Menu items are displayed below a JMenu when the menu is clicked.

That is why you should always post a SSCCE when you post a question so we don't have to guess what you are talking about.
Mathew Mintalm
Ranch Hand

Joined: Feb 21, 2010
Posts: 103

It is a tabbed pane.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

So the entire question is wrong.

JTabbedPane works with ChangeListener when its tab is changed. Try that out.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Mathew Mintalm
Ranch Hand

Joined: Feb 21, 2010
Posts: 103

Could you show me little example how to use this one?

Yes i saw your link and also I saw guide on sun website but still cant understand how does it work.



I have something like this
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

Mathew Mintalm
Ranch Hand

Joined: Feb 21, 2010
Posts: 103

Ok, thank you I think I got it a bit.

But now should I create something like:



But of course its wrong, can you help me one more time?

Sorry anyway.
Mathew Mintalm
Ranch Hand

Joined: Feb 21, 2010
Posts: 103

Ok, thank you I think I got it a bit.

But now should I create something like:



But of course its wrong, can you help me one more time?

Sorry anyway.


/edit - ok thank you, already done.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

What's wrong with that? Please TellTheDetails.
Mathew Mintalm
Ranch Hand

Joined: Feb 21, 2010
Posts: 103

I did it in another method, anyway works.

Something like:

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

I do hope you use the equals method to compare Strings, not ==.
Mathew Mintalm
Ranch Hand

Joined: Feb 21, 2010
Posts: 103

Oh, right :P Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Action for JMenuItem