Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.*;

public class Main {
    public static int getIndex(Container parent, Component child) {
        for (int i = 0; i < parent.getComponentCount(); i++) {
            if (child.equals(parent.getComponent(i)))
                return i;
        }
        return -1;
    }
}