Results 1 to 2 of 2
Thread: scroll popupmenu
- 11-17-2010, 11:29 PM #1
Member
- Join Date
- Jan 2010
- Posts
- 61
- Rep Power
- 0
scroll popupmenu
i make this code to let the user to choose item using popup menu
popup object return popup menu with items , how to scrolling popup menu ?Java Code:private void jTextPane1MouseReleased(java.awt.event.MouseEvent evt) { if (evt.getButton() == evt.BUTTON3) { popup.getMenu().show(evt.getComponent(), evt.getX(), evt.getY()); //with no scrolling } }
- 11-18-2010, 05:17 AM #2
First off, for cross platform compatibility you should be testing for e.isPopupTrigger() in both mousePressed and mouseReleased
MouseEvent (Java Platform SE 6))
The most common programming idiom for this is (in the MouseListener)This may be useful to you for scrolling the menu:Java Code:public void mousePressed(MouseEvent e) { maybeShowPopup(e); } public void mouseReleased(MouseEvent e) { maybeShowPopup(e); } private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { // show popup } }
Menu Scroller « Java Tips Weblog
Finally, I see from the code you posted that you have used some kind of code generator. Don't. Or at least, don't use any automated means of creating a GUI until you are capable of producing the same GUI by manual coding. Which you aren't (yet), or you wouldn't be asking questions here.
db
Similar Threads
-
smooth-scroll
By designer in forum Java AppletsReplies: 1Last Post: 07-21-2009, 07:10 PM -
Scroll message
By getkiran in forum Java AppletsReplies: 1Last Post: 03-05-2009, 04:29 AM -
Hello!! I need to add a popupMenu to a menu
By andr33i_yo in forum AWT / SwingReplies: 10Last Post: 12-30-2008, 12:22 PM -
various actions in menuitem of popupmenu
By Peggy in forum Java AppletsReplies: 0Last Post: 12-11-2008, 11:50 AM -
Jtextarea and scroll
By ziniestro in forum AWT / SwingReplies: 2Last Post: 06-01-2007, 03:59 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks