Пример #1
0
 /**
  * Adds a specific <tt>Component</tt> to a specific <tt>JComponent</tt> container. Allows
  * extenders to apply custom logic to the exact placement of the specified <tt>Component</tt> in
  * the specified container.
  *
  * @param component the <tt>Component</tt> to be added to the specified <tt>JComponent</tt>
  *     container
  * @param container the <tt>JComponent</tt> container to add the specified <tt>Component</tt> to
  * @param preferredIndex the index at which <tt>component</tt> is to be added to
  *     <tt>container</tt> if possible or <tt>-1</tt> if there is no preference with respect to the
  *     index in question
  */
 protected void addComponentToContainer(
     Component component, JComponent container, int preferredIndex) {
   if ((0 <= preferredIndex) && (preferredIndex < getComponentCount(container)))
     container.add(component, preferredIndex);
   else container.add(component);
 }