• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Action for JMenuItem

 
Mathew Mintalm
Ranch Hand
Posts: 103
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Recommended reading:
http://catb.org/~esr/faqs/smart-questions.html
http://mindprod.com/jgloss/sscce.html
 
Mathew Mintalm
Ranch Hand
Posts: 103
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2614
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 103
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is a tabbed pane.
 
Rob Spoor
Sheriff
Pie
Posts: 20659
64
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the entire question is wrong.

JTabbedPane works with ChangeListener when its tab is changed. Try that out.
 
Mathew Mintalm
Ranch Hand
Posts: 103
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20659
64
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Mathew Mintalm
Ranch Hand
Posts: 103
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 103
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20659
64
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's wrong with that? Please TellTheDetails.
 
Mathew Mintalm
Ranch Hand
Posts: 103
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did it in another method, anyway works.

Something like:

 
Rob Spoor
Sheriff
Pie
Posts: 20659
64
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do hope you use the equals method to compare Strings, not ==.
 
Mathew Mintalm
Ranch Hand
Posts: 103
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, right :P Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic