0

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.

4
Contributors
8
Replies
9
Views
8 Years
Discussion Span
Last Post by Kishorey
0

JFrame y = new JFrame("myframe");
y.setBounds(300,400,300,300);

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??

0

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 .

0

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.

0

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 .

0

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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.