How to create a JButton with a menu?

后端 未结 6 761
一向
一向 2020-12-30 20:16

I want to create a Toolbar in my application. If you click a button on that toolbar, it will pop up a menu, just like in Eclipse\'s toolbar. I don\'t know how to do this in

6条回答
  •  独厮守ぢ
    2020-12-30 20:36

    I think it's the same as in AWT.

    You should put an ActionCommand on that button and when it's executed show the pop-up menu according to the mouse coordinates.

提交回复
热议问题