Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pulldown Button Menu in JToolBar?

 
Winston Rast
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create a menu in a JToolBar just like IE's Back/Forward buttons on its toolbar. I have looked everywhere to try and find some code that might enlighten me on how to do this. Does anyone out there have suggestions on how to proceed?
Thanks.
-wr
 
Vinod Venugopal
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
U can do this on the toolbar button, but this button will be a custom button which opens a popupmenu when the button is clicked. Then u can add whatever u want in the popumenu & act accordingly.
Sample code:
class PopButton extends JButton
{
....

//when button is selected or clicked in listener
showPopup();

//the method which pops a popupmenu
showPopup()
{
...
PopupMenu pop = new PopupMenu();
..
pop.add(xyz);//add whatever u want
pop.show(..);
}
}
This should work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic