• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDialog: accessing its "title bar"

 
Claude Moore
Ranch Hand
Posts: 806
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I need to add a custom handler for double-click on a JDialog's title bar. I need the component to be reactive only if user clicks twice on the title bar; the problem is I don't know how (and I did not find anything useful on the matter) access that part of the component. Can anyone suggest me how to achieve this ?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this works, but the 'JDialog.setDefaultLookAndFeelDecorated(true)' is a bit ugly

 
Claude Moore
Ranch Hand
Posts: 806
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael,

thank you so much for your reply and providing me a sample. In a nutshell, the part of the code that gives you a reference to JDialog's title is


Your code works, anyway there's another problem: I cannot drag dialog's window anymore. It seems "frozen". It's like if adding a MouseListener to d.getLayeredPane().getComponent(1) inhibits default drag handler...

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it would probably consume the mouseEvent that would normally pass to the default listener handling the dragging.

add your own mouseMotionListener for dragging

 
Darryl Burke
Bartender
Posts: 5133
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or add the custom listener to the dialog (which is where the original drag handler is added).
Took a fair amount of sleuthing through the sources to find the handler.
 
Claude Moore
Ranch Hand
Posts: 806
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thak you so much, I've tested Michael's second post code and it works greatly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic