Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.List;

import javax.swing.Action;
import javax.swing.ActionMap;

import javax.swing.JToolBar;

public class Main {
    /**
     * Populates the toolbar with actions.
     * 
     * @param toolBar
     * @param actionMap
     * @param list
     */
    public static void populateToolbar(JToolBar toolBar, ActionMap actionMap, List<Object> list) {
        for (Object object : list) {
            if (object instanceof Action) {
                toolBar.add((Action) object);
            } else {
                toolBar.add(actionMap.get(object));
            }
        }
    }
}