Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #2311 > unrolled thread

JPopUpMenu when right-cli

Started by"maro20081984" <maro20081984@THRWHITE.remove-dii-this>
First post2011-04-27 15:38 +0000
Last post2011-04-27 15:38 +0000
Articles 4 — 3 participants

Back to article view | Back to comp.lang.java.gui


Contents

  JPopUpMenu when right-cli "maro20081984" <maro20081984@THRWHITE.remove-dii-this> - 2011-04-27 15:38 +0000
    Re: JPopUpMenu when right "hiwa" <hiwa@THRWHITE.remove-dii-this> - 2011-04-27 15:38 +0000
      Re: JPopUpMenu when right "maro20081984" <maro20081984@THRWHITE.remove-dii-this> - 2011-04-27 15:38 +0000
        Re: JPopUpMenu when right "Ray Ma" <ray.ma@THRWHITE.remove-dii-this> - 2011-04-27 15:38 +0000

#2311 — JPopUpMenu when right-cli

From"maro20081984" <maro20081984@THRWHITE.remove-dii-this>
Date2011-04-27 15:38 +0000
SubjectJPopUpMenu when right-cli
Message-ID<1188056461.466771.100220@l22g2000prc.googlegroups.com>
  To: comp.lang.java.gui
hi all,
i have a problem in JPopupMenu that's supposed to appear when the user
right click on a menuItem like Favorites in Internet explorer. i've
searched alot but always i see the problem but with no solution can
any one Help me
i tried
e.consume
but nothing happened
thnx in advance

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#2312 — Re: JPopUpMenu when right

From"hiwa" <hiwa@THRWHITE.remove-dii-this>
Date2011-04-27 15:38 +0000
SubjectRe: JPopUpMenu when right
Message-ID<1188105480.426596.263600@e9g2000prf.googlegroups.com>
In reply to#2311
  To: comp.lang.java.gui
On Aug 26, 12:41 am, maro20081...@forislam.com wrote:
> hi all,
> i have a problem in JPopupMenu that's supposed to appear when the user
> right click on a menuItem like Favorites in Internet explorer. i've
> searched alot but always i see the problem but with no solution can
> any one Help me
> i tried
> e.consume
> but nothing happened
> thnx in advance

It sounds like JComboBox.
See javax.swing.plaf.basic.BasicComboPopup

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2319 — Re: JPopUpMenu when right

From"maro20081984" <maro20081984@THRWHITE.remove-dii-this>
Date2011-04-27 15:38 +0000
SubjectRe: JPopUpMenu when right
Message-ID<1188152772.942709.148880@50g2000hsm.googlegroups.com>
In reply to#2312
  To: comp.lang.java.gui
> See javax.swing.plaf.basic.BasicComboPopup
thanx for ur reply
I don't know if i didn't explain my problem or i don't understand your
point of view what i want is
i have a JMenuItem if the user  click on it, it will open the link but
if he right clicks on this menuItem a popupMenu will appear but in
the  same time the menuItem and Menu still be opened until he clicks
on the menuItem in the popUpMenu
like Favourite Menu
if the user click on a link it will be opened but right click on it
will open a popupMenu containing MenuItems (open,print...etc)
thnx again for ur care

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2327 — Re: JPopUpMenu when right

From"Ray Ma" <ray.ma@THRWHITE.remove-dii-this>
Date2011-04-27 15:38 +0000
SubjectRe: JPopUpMenu when right
Message-ID<1188317033.703119.304780@x40g2000prg.googlegroups.com>
In reply to#2319
  To: comp.lang.java.gui
> like Favourite Menu
> if the user click on a link it will be opened but right click on it
> will open a popupMenu containing MenuItems (open,print...etc)

One way to achieve this is Swing I think, is to define the "pop-up"
behavior you want for your menuItem yourself.
Just because the "Favourite" Menu in IE can behave its way doesn't
mean you can simply do the same thing by using the
standard swing component behavior. The JMenuItem by default, won't pop
up anything by mouse click if you don't define any pop-up for it.
A JMenue, if it's a subMenu in a menu list and it has menuItems(such
as the IE->Favourite->Links), the Links will pop up
its MenuItem when your mouse move onto the "Links". This is standard
Swing behavior.

If you want mouse Pop up when user click on a MenuItem, you need to
addListener:
myMenuItem.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent ae){
                 JOptionPane.showOptionDialog(parent,"confirm
Msg","Confirm Dialog",
 
JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,
                                     null,myYesNoOptions,"yes");
                 //Show a dialogWindow maybe
            }
});

If you want the MenuItem to popup sth when mouse Right click, you may
addMouseListener on that MenuItem,
and only reponse to Right click by:
           if((MouseEvent)me.getButton()==MouseEvent.Button3)
                 //yourPopUpMenu.show();

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web