Hi All, Does anyone know how I can move a JWindow at runtime? I want to use JWindow because I do not want the title bar. Do I need to hook up a listener or what? Also, is there a way to set up some kind of border on a JWindow? Thanks for your help!
No, no, no........ Sorry about the confusion. I meant the user moving the window. Since it has no title bar, a user cannot move it. So, is there a way to fix this? Thanks, Barry
The best way to do it is to implement a mouse motion listener to either the entire window or a component within the window. Then when the user clicks and drags on that part you can have the entire window move to the new location. It is quite simple code. I have done it before, but it is on a different comp. I will post it tonight unless someone else does. ------------------ I hope its helps, feel free to email me [email protected]
Barry, here is the code that I used a while back in one of my applications. It is concise and works great. Just use the handler for your mousemotion. <PRE> class MouseMotionHandler extends MouseMotionAdapter { public void mouseDragged(MouseEvent e) { window.setLocation( window.getLocationOnScreen().x - (p.x - e.getX()), window.getLocationOnScreen().y - (p.y - e.getY())); } } </PRE>