DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Java (http://www.daniweb.com/forums/forum9.html)
-   -   fixing position of awt objects in java (http://www.daniweb.com/forums/thread165594.html)

nitinnitin18 Jan 2nd, 2009 12:38 am
fixing position of awt objects in java
 
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.

stephen84s Jan 2nd, 2009 1:12 am
Re: fixing position of awt objects in java
 
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.

BestJewSinceJC Jan 2nd, 2009 4:20 pm
Re: fixing position of awt objects in java
 
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


All times are GMT -4. The time now is 5:12 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC