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.util.Arrays;

import javax.swing.Box;

public class Main {
    /**
     * Places the given components in a horizontal Box with a glue at the end,
     * causing the components to align left.
     * @param components the components to add
     * @return the components in a horizontal Box, aligned left
     */
    public static Box buildLeftAlignedRow(Component... components) {
        final Box result = Box.createHorizontalBox();
        Arrays.stream(components).forEach(result::add);
        result.add(Box.createHorizontalGlue());
        return result;
    }
}