943,776 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 4961
  • Java RSS
Apr 30th, 2009
0

Getting window size

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Kishorey is offline Offline
13 posts
since May 2008
Apr 30th, 2009
0

Re: Getting window size

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??
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
zyaday is offline Offline
70 posts
since Jun 2008
Apr 30th, 2009
0

Re: Getting window size

Click to Expand / Collapse  Quote originally posted by Kishorey ...
Is it possible to get the window size in Java
the getSize() method, amazingly, will do it
Featured Poster
Reputation Points: 1924
Solved Threads: 951
Posting Expert
JamesCherrill is online now Online
5,769 posts
since Apr 2008
Apr 30th, 2009
-1

Re: Getting window size

To top up what JamesCherrill already said about getting size, to set position you can use methods inherited from Component setLocation(int x,int y) or setLocation(Point p)
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 873
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004
Apr 30th, 2009
0

Re: Getting window size

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 .
Last edited by Kishorey; Apr 30th, 2009 at 8:06 am. Reason: mistake
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Kishorey is offline Offline
13 posts
since May 2008
Apr 30th, 2009
0

Re: Getting window size

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.
Featured Poster
Reputation Points: 1924
Solved Threads: 951
Posting Expert
JamesCherrill is online now Online
5,769 posts
since Apr 2008
Apr 30th, 2009
0

Re: Getting window size

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 .
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Kishorey is offline Offline
13 posts
since May 2008
Apr 30th, 2009
0

Re: Getting window size

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!
Featured Poster
Reputation Points: 1924
Solved Threads: 951
Posting Expert
JamesCherrill is online now Online
5,769 posts
since Apr 2008
Apr 30th, 2009
0

Re: Getting window size

ya thanks for ur response....i 'll try
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Kishorey is offline Offline
13 posts
since May 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: help with methods
Next Thread in Java Forum Timeline: Learning Java, need some help with ATM program





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC