• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LayoutMangers or Setting components?

 
Saheed Adepoju
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I have done some software development in the past and i am used to setting the components myself unto a JFrame! I use no Layout managers! I know for the SCJD assignment, everyone has adviced me to use a layout manager, saying that it saves time. Is there any other advantages besides this? I certainly would like to set up the components myself! Your responses as usual wuld be highly appreciated. Thanks.
Saheed.
SCJP 1.4
SCJD(preparing..)
Imagination is better than Knowledge..
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Saheed,

If you are explicitly specifying where components are to be placed, how does your application handle frame resizing?

Regards, Andrew
 
Saheed Adepoju
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Andrew Monkhouse:
Hi Saheed,

If you are explicitly specifying where components are to be placed, how does your application handle frame resizing?

Regards, Andrew


Hi
I dont seem to understand ur question! But i usually set the size of the frame! And then place the components! What i hear is that whenever u transfer ur code to another O/S u might have problems with the conponents being set, but with Layout Managers u dont have to worry? Pls culd u further break down ur reply! And thank u for ur reply!
Saheed.
SCJP 1.4
SCJD(preparing..)
Imagination is better than Knowledge.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Saheed,

As you have noted, explicitly specifying where to place objects within your container can lead to portability issues. This is often most evident around buttons (where buttons are physically different sizes on different operating systems) - having an explicit placement can cause components to "bump into each other" when you change operating systems, or for them to appear too far away from each other. Layout managers are designed to handle these differences, allowing you to specify relative placements (put this button to the right of that button, taking care of all spacing issues on all different operating systems for me).

Another issue becomes evident when the user chooses to change the size of your application frame. You could stop the user from ever doing this (not very user friendly), allow the screen size to change without changing the size of the components in the screen (looks ugly), or write code to increase the size of specified components proportionally (which is what many of the Layout Managers do - you can specify which components should always be a "standard" size (e.g. buttons) and which should expand to fill the new size of the screen (e.g. tables)).

On a separate topic, could you please try to spell words out fully in your posts? Abbreviations such as "ur", "u", "Pls", "culd" detract from reading your post, and I, like many others here, will simply skip posts if they are too hard to read. I can only imagine how much harder it is for someone who is just learning English to try and decipher these abreviations.

Regards, Andrew
 
Saheed Adepoju
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thanks alot for your response i guess i had better stick to the layout managers. I have also noted the abbreviations! Sorry to all for the abbreviations, i am so used to them! My faults have been noted and will be changed. Thanks .
Saheed.
Imagination is better than Knowledge.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic