fixing position of awt objects in java

Reply

Join Date: Jan 2009
Posts: 1
Reputation: nitinnitin18 is an unknown quantity at this point 
Solved Threads: 0
nitinnitin18 nitinnitin18 is offline Offline
Newbie Poster

fixing position of awt objects in java

 
0
  #1
Jan 2nd, 2009
i was writing a code for the applet in the awt class.

but i was confused as i couldnt find any function to fix the position of button or textbox in the applet.
the only solution which i got was using layout manager.

but then i also couldnt find the function to fix the size of the button.

even the setSize() and setLocation() functions were not working.
Last edited by nitinnitin18; Jan 2nd, 2009 at 12:39 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: fixing position of awt objects in java

 
0
  #2
Jan 2nd, 2009
If you wish to be ale to fix the size and location of a component (irrespective of the users screen size, resolution etc), you will need to set your layout to "null" (not recommended) and then set the co-ordinates for each component manually.

But then this could handicap your users who may not be using the optimum resolution and screen size for which you designed your GUI.

Look here and here for more information on absolute positioning of components using null layout.
Last edited by stephen84s; Jan 2nd, 2009 at 1:34 am.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,560
Reputation: BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all 
Solved Threads: 196
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso

Re: fixing position of awt objects in java

 
0
  #3
Jan 2nd, 2009
This might also be useful to you, as it gives greater control than most of the other layout managers. But I'm not sure why setSize isn't working... post your code? http://java.sun.com/docs/books/tutor...t/gridbag.html
Reply With Quote Quick reply to this message  
Reply

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



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