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
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
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();
}
}