• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get default menu items from JDialog?

 
Jack Wanes
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JDialog with default menu bar with menu items such as "Move", "Size", and "Close". I am trying to
get the "Move" menuItem and then programatically do a click on it. But I cannot get this menu item using the following piece of code:




I guess there must be a way to get this. Any idea?

regards,
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you have isn't a JMenuBar. It's something the OS puts on window title bars. You can't get to it directly through java. At least, not that I am aware of.
 
Jack Wanes
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the clarifications. So we have no way to do this?

I guess I have to create another menu to simulate its behavior.

thanks,


Gregg Bolinger wrote:What you have isn't a JMenuBar. It's something the OS puts on window title bars. You can't get to it directly through java. At least, not that I am aware of.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What behavior?
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to move your JDialog around programatically, check out the setLocation() method.
 
Jack Wanes
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The behavior of that Move menu item.

Gregg Bolinger wrote:What behavior?
 
Rob Spoor
Sheriff
Pie
Posts: 20494
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a MouseInputListener to implement it yourself:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic