Java Swing Icon getIcon(int index)

Here you can find the source of getIcon(int index)

Description

This function returns the icon at a specific index

License

Open Source License

Parameter

Parameter Description
index the index of the icon to get

Return

The icon at index

Declaration

public static synchronized Icon getIcon(int index) 

Method Source Code

//package com.java2s;
/*************************************************************************
    //from www  .  ja  v  a2  s.  co m
This file is part of Open ModelSphere HTML Reports Project.
    
Open ModelSphere HTML Reports is free software; you can redistribute
it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
    
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
    
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
or see http://www.gnu.org/licenses/.
    
You can redistribute and/or modify this particular file even under the
terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
    
You should have received a copy of the GNU Lesser General Public License 
(LGPL) along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
or see http://www.gnu.org/licenses/.
    
You can contact us at :
http://www.javaforge.com/project/3219
    
 **********************************************************************/

import java.util.ArrayList;
import javax.swing.Icon;

public class Main {
    /** The list of icons */
    private static ArrayList<Icon> icons;

    /**
     * This function returns the icon at a specific index
     * 
     * @param index
     *            the index of the icon to get
     * @return The icon at index
     */
    public static synchronized Icon getIcon(int index) {
        if (index >= 0 && index < icons.size()) {
            return icons.get(index);
        }

        return null;
    }
}

Related

  1. getIcon(boolean isPressed, Icon baseIcon_)
  2. getIcon(Class baseclass, String name)
  3. getIcon(Class clazz, String path)
  4. getIcon(final String path)
  5. getIcon(final String resource)
  6. getIcon(String _package, String iconName)
  7. getIcon(String f, Class c)
  8. getIcon(String name)
  9. getIcon(String name)