title: Adding components into Component[] array
body: <p>This seems so basic, but for some reason I can't get it to work.</p>
  
  <p>I have the following code:</p>
  
  <pre><code>Component[] AddEditDelete = ToolbarPool.getDefault().findToolbar("AddEditDelete").getComponents();
  for (Component component : AddEditDelete) {
      component.setEnabled(false);
  }
  
  Component[] Navigation = ToolbarPool.getDefault().findToolbar("Navigation").getComponents();
  for (Component component : Navigation) {
      component.setEnabled(false);
  }
  
  Component[] ListFind = ToolbarPool.getDefault().findToolbar("ListFind").getComponents();
  for (Component component : ListFind) {
      component.setEnabled(false);
  }
  </code></pre>
  
  <p>What I would want to do is create a single Component[] c array and then into that array, add all the components from the Toolbars.</p>
  
  <p>My intuitive approach of</p>
  
  <pre><code>Component[] c;
  c.add(stuff);
  </code></pre>
  
  <p>Didn't seem to work. So I assume you do it else-how.</p>
  
  <p><strong>edit1:</strong> My most recent attempt with ArrayList > Component didn't work =(</p>
  
  <pre><code>ArrayList c = new ArrayList();
  c.add(ToolbarPool.getDefault().findToolbar("AddEditDelete").getComponents());
  c.add (ToolbarPool.getDefault().findToolbar("Navigation").getComponents());
  Component[] cc = (Component[]) c.toArray();
  for (Component component : cc) {
      component.setEnabled(false);
  }
  </code></pre>
  
  <p><strong>edit2:</strong> Silly me, trying to use ArrayList without a type. This works, but it will still be quite a few lines of code:</p>
  
  <pre><code>ArrayList&lt;Component&gt; c = new ArrayList&lt;Component&gt;();
  for (int i = 0; i &lt; ToolbarPool.getDefault().findToolbar("AddEditDelete").getComponents().length; i++) {
      c.add(ToolbarPool.getDefault().findToolbar("AddEditDelete").getComponent(i));
  }
  for (int i = 0; i &lt; ToolbarPool.getDefault().findToolbar("Navigation").getComponents().length; i++) {
      c.add(ToolbarPool.getDefault().findToolbar("Navigation").getComponent(i));
  }
  for (Component component : c) {
      component.setEnabled(false);
  }
  </code></pre>
  
  <p>Is there a way to shorten the amount of lines of code?</p>