Java Swing TitledBorder setTitleBorder(JComponent pane, String title)

Here you can find the source of setTitleBorder(JComponent pane, String title)

Description

set Title Border

License

Open Source License

Declaration

public static void setTitleBorder(JComponent pane, String title) 

Method Source Code

//package com.java2s;
/*/*from   w w w  . jav  a  2s  .c  o  m*/
 * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
 * All rights reserved. This program is made available under the terms of the
 * Eclipse Public License v1.0 which accompanies this distribution, and is
 * available at http://www.eclipse.org/legal/epl-v10.html
 * Contributors:
 * General Robotix Inc.
 * National Institute of Advanced Industrial Science and Technology (AIST) 
 */

import java.awt.Color;

import javax.swing.JComponent;

import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;

public class Main {
    public static void setTitleBorder(JComponent pane, String title) {
        if (title != null) {
            pane.setBorder(new TitledBorder(new LineBorder(Color.BLACK),
                    title, TitledBorder.LEFT, TitledBorder.TOP));
        } else {
            pane.setBorder(new LineBorder(Color.BLACK));
        }
    }
}

Related

  1. setBoldTitledBorder(String title, JComponent p)
  2. setBorder(Container panel, String title)
  3. setBorder(JComponent component, String text, int titleJustification)
  4. setLabelBorder(String label, JComponent c)
  5. setPanelBorder(final JPanel p, final String s)
  6. titledBorder(String title, B comp)
  7. withTitledBorder(String title, JComponent c)