Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import javax.swing.ActionMap;

import javax.swing.JComponent;

public class Main {
    public static ActionMap installActionMap(JComponent c, ActionMap map) {
        if (map == null) {
            return null;
        }

        ActionMap currentMap = c.getActionMap();
        if (currentMap != null) {
            ActionMap parent = currentMap;
            while (parent.getParent() != null) {
                if (parent == map) {
                    return map;
                }
                parent = parent.getParent();
            }
            parent.setParent(map);
        } else {
            c.setActionMap(map);
        }
        return map;
    }
}