Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.Component;
import java.awt.Container;

import java.awt.event.KeyListener;

public class Main {
    public static void addKeyListener(Component p_c, KeyListener p_listener) {
        if (p_c != null) {
            p_c.addKeyListener(p_listener);

            Component[] cs = null;

            if (p_c instanceof Container) {
                cs = ((Container) p_c).getComponents();
            }

            for (int i = 0; i < cs.length; i++) {
                addKeyListener(cs[i], p_listener);
            }
        }
    }
}