Here you can find the source of buildToolbar(final JToolBar toolbar, final List
Parameter | Description |
---|---|
toolbar | a parameter |
components | a parameter |
public static void buildToolbar(final JToolBar toolbar, final List<Component> components)
//package com.java2s; // it under the terms of the GNU General Public License as published by import javax.swing.*; import java.awt.*; import java.util.Iterator; import java.util.List; public class Main { /*********************************************************************************************** * Build a new JToolbar and add a List of Components. * Never returns NULL./*from www. j a v a 2s . c o m*/ * * @param components * * @return JToolBar */ public static JToolBar buildToolbar(final List<Component> components) { final JToolBar toolbar; toolbar = new JToolBar(); // Build the Toolbar using the Components, if any // If the List is empty, we assume the User doesn't want any buttons... buildToolbar(toolbar, components); return (toolbar); } /*********************************************************************************************** * Add a List of Components to the specified JToolBar. * Never returns NULL. * * @param toolbar * @param components */ public static void buildToolbar(final JToolBar toolbar, final List<Component> components) { // Build the Toolbar using the Components, if any // If the List is empty, we assume the User doesn't want any buttons... if ((toolbar != null) && (components != null) && (!components.isEmpty())) { final Iterator<Component> iterComponents; iterComponents = components.iterator(); while (iterComponents.hasNext()) { final Component component; component = iterComponents.next(); if (component != null) { toolbar.add(component); } } } } }