Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static int getContainerWidth(Container container) {
        int width = 0;
        for (int index = 0; index < container.getComponentCount(); index++) {
            int offset = (container.getComponent(index).getX() + container.getComponent(index).getWidth());
            if (offset > width) {
                width = offset;
            }
        }
        return width;
    }
}