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.Dimension;

public class Main {
    public static void padPreferredWidthDeep(Component component, int padding) {
        if (component instanceof Container) {
            for (Component child : ((Container) component).getComponents()) {
                padPreferredWidthDeep(child, padding);
            }
        }
        component.setPreferredSize(new Dimension((int) component.getPreferredSize().getWidth() + padding,
                (int) component.getPreferredSize().getHeight()));
    }
}