Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import javax.swing.InputMap;
import javax.swing.JComponent;

public class Main {
    public static InputMap installInputMap(JComponent c, InputMap map, int condition) {
        if (map == null) {
            return null;
        }

        InputMap currentMap = c.getInputMap(condition);
        if (currentMap != null) {
            InputMap parent = currentMap;
            while (parent.getParent() != null) {
                parent = parent.getParent();
            }
            parent.setParent(map);
        } else {
            c.setInputMap(condition, map);
        }
        return map;
    }
}