Java Swing Empty Border setStandardBorder(JComponent aComponent)

Here you can find the source of setStandardBorder(JComponent aComponent)

Description

Sets a standard border of the given component.

License

Open Source License

Parameter

Parameter Description
aComponent Component to get a standard border. This component will lose its previous border, if any.

Declaration

public static void setStandardBorder(JComponent aComponent) 

Method Source Code

//package com.java2s;
/*/*from  www .j  a  va  2  s  . c  o m*/
 * Copyright (c) 2006, 2007, 2008, 2010, Max Planck Institute for Informatics, Saarbruecken, Germany.
 *
 * This file is part of NetworkAnalyzer.
 * 
 * NetworkAnalyzer is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 * 
 * NetworkAnalyzer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License along with NetworkAnalyzer. If not, see
 * <http://www.gnu.org/licenses/>.
 */

import javax.swing.BorderFactory;

import javax.swing.JComponent;

public class Main {
    /**
     * Default border size (padding) of dialog windows.
     */
    public static final int BORDER_SIZE = 6;

    /**
     * Sets a standard border of the given component.
     * <p>
     * The standard border is an empty border of with {@link #BORDER_SIZE}.
     * </p>
     * 
     * @param aComponent
     *            Component to get a standard border. This component will lose its previous border, if any.
     */
    public static void setStandardBorder(JComponent aComponent) {
        final int bs = BORDER_SIZE;
        aComponent.setBorder(BorderFactory
                .createEmptyBorder(bs, bs, bs, bs));
    }
}

Related

  1. makeEmptyBorderResource(int top, int left, int bottom, int right)
  2. padBorder(JComponent component, int top, int left, int bottom, int right)
  3. removeBorder(JComponent component)
  4. scrollView(Component component, Border border)
  5. setEmptyBorder(int top, int left, int bottom, int right, JComponent... components)
  6. spacingBorder()
  7. wrapEmptyBorder(Component content, int top, int left, int bottom, int right)