building draggable and resizable JWindow

does anybody know how to make a JWindow draggable and resizable?It's hard to find a resource about this case. it would be grateful if someone gives me a url or any info.
[184 byte] By [caesarkim1a] at [2007-11-26 22:19:45]
# 1

not sure to understand what you want?

resizing a JWindow: with the mouse

dragging a JWindow: with the mouse

a JWindow is a top level Component...

if you are interested in draggable stuff, check this article

http://java.sun.com/docs/books/tutorial/uiswing/dnd/intro.html

suparenoa at 2007-7-10 11:16:08 > top of Java-index,Desktop,Core GUI APIs...
# 2
there won't be any component(label or textfield, etc) in the JWindow. I just want to build a simple JWindow and want to use mouse to drag and resize a window built from extending JWindow. is it possible to do that?
caesarkim1a at 2007-7-10 11:16:08 > top of Java-index,Desktop,Core GUI APIs...
# 3

moving would be simple enough - just add a MouseMotionListener and in

mouseDragged() change the location

resizing? - perhaps check the coords of the mousePointer - if at an extremity,

change pointer to left-right or up-down, and in mouseDragged if pointer not

default, resize rather than relocate

Michael_Dunna at 2007-7-10 11:16:08 > top of Java-index,Desktop,Core GUI APIs...
# 4

Here is my code. can't figure out how to resize the window by dragging the border. For now, it has white background.

public class Test extends JWindow implements MouseMotionListener,

FocusListener {

Point mousePointer;

public Test() {

init();

setVisible(true);

}

public void init() {

addMouseMotionListener(this);

setBounds(500, 500, 400, 400);

addFocusListener(this);

}

public void focusGained(FocusEvent aFocusEvent) {

Point aPoint = getLocation();

setLocation(15000, 0);

setLocation(aPoint);

}

public void focusLost(FocusEvent aFocusEvent) {

}

public void mouseDragged(MouseEvent aMouseEvent)

{

Point aPoint = aMouseEvent.getPoint();

int x = getX() + aPoint.x - mousePointer.x;

int y = getY() + aPoint.y - mousePointer.y;

setLocation(x, y);

Graphics graphics = getGraphics();

paint(graphics);

}

public void mouseClicked(MouseEvent me)

{

}

public void mouseMoved(MouseEvent aMouseEvent) {

mousePointer = aMouseEvent.getPoint();

}

public void paint(Graphics graphics) {

}

protected int getDefaultCursor(MouseEvent p_Evt) {

return Cursor.DEFAULT_CURSOR;

}

public static void main(String[] args) {

new Test();

}

}

caesarkim1a at 2007-7-10 11:16:08 > top of Java-index,Desktop,Core GUI APIs...
# 5
Almost 200 postings and you still haven't figured out how to use the "Code" button above the "Message" box, so that the code you post is formatted and therefore easier to read.
camickra at 2007-7-10 11:16:08 > top of Java-index,Desktop,Core GUI APIs...