Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.Component;
import java.awt.event.ContainerAdapter;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;

import javax.swing.JFrame;

public class Main {
    public static void main() {

        ContainerListener listener = new ContainerAdapter() {
            public void componentAdded(ContainerEvent evt) {

                Component c = evt.getChild();
            }

            public void componentRemoved(ContainerEvent evt) {

                Component c = evt.getChild();
            }
        };

        JFrame frame = new JFrame();
        frame.addContainerListener(listener);
    }
}