Getting window size

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: May 2008
Posts: 13
Reputation: Kishorey is an unknown quantity at this point 
Solved Threads: 0
Kishorey Kishorey is offline Offline
Newbie Poster

Getting window size

 
0
  #1
Apr 30th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 46
Reputation: zyaday is an unknown quantity at this point 
Solved Threads: 1
zyaday zyaday is offline Offline
Light Poster

Re: Getting window size

 
0
  #2
Apr 30th, 2009
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??
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 977
Reputation: JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice 
Solved Threads: 145
JamesCherrill JamesCherrill is offline Offline
Posting Shark

Re: Getting window size

 
0
  #3
Apr 30th, 2009
Originally Posted by Kishorey View Post
Is it possible to get the window size in Java
the getSize() method, amazingly, will do it
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,208
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 488
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Getting window size

 
-1
  #4
Apr 30th, 2009
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)
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 13
Reputation: Kishorey is an unknown quantity at this point 
Solved Threads: 0
Kishorey Kishorey is offline Offline
Newbie Poster

Re: Getting window size

 
0
  #5
Apr 30th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 977
Reputation: JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice 
Solved Threads: 145
JamesCherrill JamesCherrill is offline Offline
Posting Shark

Re: Getting window size

 
0
  #6
Apr 30th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 13
Reputation: Kishorey is an unknown quantity at this point 
Solved Threads: 0
Kishorey Kishorey is offline Offline
Newbie Poster

Re: Getting window size

 
0
  #7
Apr 30th, 2009
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 .
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 977
Reputation: JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice 
Solved Threads: 145
JamesCherrill JamesCherrill is offline Offline
Posting Shark

Re: Getting window size

 
0
  #8
Apr 30th, 2009
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!
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 13
Reputation: Kishorey is an unknown quantity at this point 
Solved Threads: 0
Kishorey Kishorey is offline Offline
Newbie Poster

Re: Getting window size

 
0
  #9
Apr 30th, 2009
ya thanks for ur response....i 'll try
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC