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 front,
     * causing the components to align right.
     * @param components the components to add
     * @return the components in a horizontal box, aligned right
     */
    public static Box buildRightAlignedRow(Component... components) {
        final Box result = Box.createHorizontalBox();
        result.add(Box.createHorizontalGlue());
        Arrays.stream(components).forEach(result::add);
        return result;
    }
}