Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Bill Howell   on May 05 In Java Category.

  
Question Answered By: Chaths Massri   on May 05

> I meant creating  an array  of components  using the gui editor.
Currently I just leave a blank space and create  the components using
a for loop, but I was wondering if there is a better way.


Again, I feel as if I am not understanding your exact needs, but I'll
give it a guess.

"Creating an array of components" --> utilizing a for(loop) is
standard practice and the best way, IMHO, for anything with more than
3-4 components.

What baffles me is your inclusion of "...I just leave a blank
space..." I'm guessing that you are not using Java Layouts and hand
laying your components on the "Absolute" ( <--- not exactly correct
for all you nit(nose)pickers) Layout. In this case there are far
better ways. Absolute layouts like the GUI Editor utilize a pixel
coordinate system that can cause programs that look great on your
system to become unusable on others... such as component overlapping
or frame edge cutoffs. If I'm still guessing right, hardly likely,
you are using the default layout: FlowLayout. There are several
more layout managers that can assist in placing components, some are
FlowLayout, GridLayout, BorderLayout (my favorite), Card Layout, and
the confusing, although very powerful GridBagLayout.

Share: