File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Right Click Option in JtextPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Right Click Option in JtextPane" Watch "Right Click Option in JtextPane" New topic

Right Click Option in JtextPane

Siddique Ansari

Joined: May 11, 2013
Posts: 21
I want to get options "Add to Name".. etc.. and am getting that.. but my problem is when I right click first then it show all MenuItems once, When I right click Again it shows all the options twice, when I right click again then it shows thrice. Tell me whats the problem?

Piet Souris
Ranch Hand

Joined: Mar 08, 2009
Posts: 318
Hi Siddique,

well, have a look at line 17. You add an item to a menu. But suppose that item was already present in that menu (say, from a former right mouse click)?

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 36478
And welcome to the Ranch
Siddique Ansari

Joined: May 11, 2013
Posts: 21
I agree. Here's the link:
subject: Right Click Option in JtextPane
Similar Threads
Addind with javascript
smtp server name while using jmail
JPopupMenu on a JTable Header Selection Problem
Addind a word in the String
Jtree and Popup Menu