Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import javax.swing.*;

public class Main {
    public static void mapAction(JComponent c, int condition, KeyStroke keyStroke, Action action) {
        Object key = action.getValue(Action.NAME);
        if (key == null)
            throw new IllegalArgumentException("The provided action must " + "have a name defined");
        mapAction(c, condition, key, keyStroke, action);
    }

    public static void mapAction(JComponent c, int condition, Object key, KeyStroke keyStroke, Action action) {
        c.getActionMap().put(key, action);
        c.getInputMap(condition).put(keyStroke, key);
    }
}