HI ,
Is it possible to get the window size in Java ,if so cld any 1 guide me....and also i need to fix the windows in a particular position ..how cld i do ds in Java.

JFrame y = new JFrame("myframe");

You could try this , the first two variables being for the X and Y position where the frame is put and the next two for the widtha nd heigth..Does this solve your problem??

thanks for the response....
but i really need a solution to align the window borders so tat the newly opened windows will not overlap the current window that is running instead their borders have to be aligned so tat i can view both the windows as in Google Desktop Gadgets.Gotta!!!
I need a help in this .

You've got all you need here. From the position and size you know where the borders are. Try drawing a couple of touching rectangles on a sheet of paper and marking the positions and sizes on them - this should make all the relationships pretty obvious.

hi james,
setLocation gives the location of the window which i'm executing ,so i need the location of the other windows say netbeans i ve opened now so that the netbeans shouldnt overlap the frame or vice versa .,instead it shld align with the frame borders n i shld b able to view both the windows ...
hence i 'm asking how 2 get the location of the netbeans .

Sorry, I thought both (all) the windows were part of your app. If some of them are not then you will need to get into the Windows/Mac/Linux system apis. Good luck!

This article has been dead for over six months. Start a new discussion instead.