This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Originally posted by Rob Prime: Undecorated but still movable? How did you do that?
Because it's the decoration that usually allows for things such as moving and resizing.
Moving to AWT / Swing since it's clearly user interface related.
here is how you make movable undecorated window...I wasnt the creator of this code, I just added the if(!e.isMetaDown()) so only the left button would work for moving the window(just like the msn ones)
here is how you make movable undecorated window...
Well you could do something similar for resizing. You would have to (1) examine the click more closely to determine if it should be a move gesture, a resize gesture, or neither (2) call setSize() [or setBounds()] instead of setLocation() on resize gestures
I don't know your requirements ,but I'd be tempted to just use the window decorations. [ November 05, 2008: Message edited by: Brian Cole ]
Originally posted by Breno Salgado: here is how you make movable undecorated window...
I should have known you'd have done it that way. I've written a mouse listener class just like that. I just never thought of using it for frames / windows, just other components.
As Brian said, you can do the same for resizing. Based on the location you can set the cursor to "new Cursor(Cursor.W_RESIZE_CURSOR)" or one of the other default cursors, and also how the drag will behave: move for the center, and resizing in the right direction for the borders.
Title pane? Can you please explain what that is, and how you can remove it? Because the API mentions no such thing (unless I've missed it).
Joined: Jun 09, 2003
Joined: Nov 05, 2008
that's helpfull! thanks!
but damn, I'd like to learn how to do the resize method... Im trying here but I've been unable to test it properly because when I click the retangle thats the box to resize its still using the move method and its getting really messy
I tried with an IF in a higher state but Im getting syntax problems all the time, Im about to give up
I've tried Michael's code but it only works with the (current version of) default metal look&feel. If you switch to the system look&feel it fails horribly. And it may also fail in a new version of Java.
Joined: Jun 09, 2003
> but damn, I'd like to learn how to do the resize method...
here's one way - but I've only added code to resize by dragging to the right (east), you'll need to add code for the remainder, as well as the corners (and you may want to modify when the cursor changes to <-->)
 disable smileys, >) is a smiley [ November 06, 2008: Message edited by: Michael Dunn ]