package net.sf.kerner.utils.swing.impl.util;

import java.awt.BorderLayout;

import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;

public class UtilSwing {

    public static JComponent buildInfoPanelEmptyBorderScroll(final JComponent content) {
        final JPanel result = new JPanel(new BorderLayout());
        result.setBorder(BorderFactory.createEmptyBorder());
        final JScrollPane scroll = new JScrollPane(content);
        result.add(scroll, BorderLayout.CENTER);
        return result;
    }

    public static JComponent buildInfoPanelEmptyBorderScroll(final JComponent content, final int top, final int left,
            final int bottom, final int right) {
        final JPanel result = new JPanel(new BorderLayout());
        result.setBorder(BorderFactory.createEmptyBorder(top, left, bottom, right));
        final JScrollPane scroll = new JScrollPane(content);
        result.add(scroll, BorderLayout.CENTER);
        return result;
    }

    public static JComponent buildInfoPanelTextBorder(final JComponent content, final String title) {
        final JPanel result = new JPanel(new BorderLayout());
        result.setBorder(BorderFactory.createTitledBorder(title));
        result.add(content, BorderLayout.CENTER);
        return result;
    }

    public static JComponent buildInfoPanelTextBorder(final JLabel content, final String title) {
        content.setHorizontalAlignment(SwingConstants.CENTER);
        content.setVerticalAlignment(SwingConstants.CENTER);
        content.setOpaque(true);
        return buildInfoPanelTextBorder((JComponent) content, title);
    }

    public static JComponent buildInfoPanelTextBorderScroll(final JComponent content, final String title) {
        final JPanel result = new JPanel(new BorderLayout());
        result.setBorder(BorderFactory.createTitledBorder(title));
        final JScrollPane scroll = new JScrollPane(content);
        result.add(scroll, BorderLayout.CENTER);
        return result;
    }

    public static JComponent buildPanelEmptyBorder(final JComponent content, final int top, final int left,
            final int bottom, final int right) {
        final JPanel result = new JPanel(new BorderLayout());
        result.setBorder(BorderFactory.createEmptyBorder(top, left, bottom, right));

        result.add(content, BorderLayout.CENTER);
        return result;
    }

    private UtilSwing() {
    }

}

@@ -68,16 +68,95 @@
 rLayout;
+%0Aimport java.awt.Component;%0Aimport java.awt.Dimension;%0Aimport java.awt.Toolkit;
 %0A%0Aimport
@@ -2569,24 +2569,433 @@
 ult;%0A    %7D%0A%0A
+    public static void center(final Component component) %7B%0A        final Toolkit tk = Toolkit.getDefaultToolkit();%0A        final Dimension screenSize = tk.getScreenSize();%0A        final int screenHeight = screenSize.height;%0A        final int screenWidth = screenSize.width;%0A        component.setSize(screenWidth / 2, screenHeight / 2);%0A        component.setLocation(screenWidth / 4, screenHeight / 4);%0A    %7D%0A%0A
     private 

Add UtilSwing#center().