Java Swing BorderLayout wrapInBorderPanel(final JComponent component)

Here you can find the source of wrapInBorderPanel(final JComponent component)

Description

Wraps a component in a JPanel with BorderLayout .

License

Apache License

Parameter

Parameter Description
component component to be wrapped

Return

a JPanel with the specified component added to it

Declaration

public static JPanel wrapInBorderPanel(final JComponent component) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.awt.BorderLayout;

import javax.swing.JComponent;

import javax.swing.JPanel;

public class Main {
    /**//from w w w.  j  a v a 2 s . co  m
     * Wraps a component in a JPanel with {@link BorderLayout}.
     * @param component component to be wrapped
     * @return a JPanel with the specified component added to it
     */
    public static JPanel wrapInBorderPanel(final JComponent component) {
        final JPanel panel = new JPanel(new BorderLayout());
        panel.add(component);
        return panel;
    }
}

Related

  1. createPanel(JComponent centerComponent, JComponent placedComponent, String borderLayoutConstraint)
  2. layoutCompactHorizontal(JComponent... list)
  3. layoutCompactVertical(JComponent... list)
  4. makeBorderPanel(int topMargin, int leftMargin, int bottomMargin, int rightMargin)
  5. makeLateralBorders(JPanel panel, Dimension reference, Border style)
  6. wrapWithBorder(JComponent aPanel, Border aBorder)