Java Swing Border createDebugBorder(JComponent c, Color color)

Here you can find the source of createDebugBorder(JComponent c, Color color)

Description

Useful debug function to place a colored, line border around a component for layout management debugging.

License

Apache License

Parameter

Parameter Description
c the component
color the border color

Declaration

public static void createDebugBorder(JComponent c, Color color) 

Method Source Code


//package com.java2s;
/*/* w  w w.ja  va 2  s . co m*/
 * Copyright 2002-2004 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 */

import java.awt.Color;

import javax.swing.BorderFactory;

import javax.swing.JComponent;

public class Main {
    /**
     * Useful debug function to place a colored, line border around a component
     * for layout management debugging.
     * 
     * @param c
     *            the component
     * @param color
     *            the border color
     */
    public static void createDebugBorder(JComponent c, Color color) {
        if (color == null) {
            color = Color.BLACK;
        }
        c.setBorder(BorderFactory.createLineBorder(color));
    }
}

Related

  1. addOuterBorder(JComponent c, Border out)
  2. clipText(JComponent c, String val, int borderWidth)
  3. compareTabOrder(Component a, Component b)
  4. copy(final Border border)
  5. createCompoundBorder(Border... borders)
  6. createFormSectionBorder(Color color, String title)
  7. createJScrollPane(Component component, Rectangle bounds, Color backgroundColor, boolean noBorder, boolean visible)
  8. createRightBorder(int size, Color color)
  9. createRoundedEmptyBorder(final int top, final int left, final int bottom, final int right, final int arc, final Color color)