Java Swing TitledBorder createTitledPanelBorder(String title)

Here you can find the source of createTitledPanelBorder(String title)

Description

create Titled Panel Border

License

BSD License

Declaration

public static TitledBorder createTitledPanelBorder(String title) 

Method Source Code

//package com.java2s;
/**// w w w. jav a 2 s  .c o m
 * Copyright (c) 2014, by the Authors: John E Lloyd (UBC)
 *
 * This software is freely available under a 2-clause BSD license. Please see
 * the LICENSE file in the ArtiSynth distribution directory for details.
 */

import java.awt.Font;

import javax.swing.BorderFactory;

import javax.swing.UIManager;
import javax.swing.border.TitledBorder;

public class Main {
    public static TitledBorder createTitledPanelBorder(String title) {
        TitledBorder border = BorderFactory.createTitledBorder(title);
        Font font = border.getTitleFont();
        if (font == null) {
            font = UIManager.getFont("TitledBorder.font"); // Java SE 7 workaround
        }
        border.setTitleFont(new Font(font.getName(), Font.ITALIC, font.getSize()));
        return border;
    }
}

Related

  1. createTitledBorder(String label)
  2. createTitledBorder(String name)
  3. createTitledBorder(String title)
  4. createTitledBorder(String title)
  5. CreateTitledBorderwMargin(String title, int topMargin, int leftMargin, int bottomMargin, int rightMargin)
  6. formatTitle(TitledBorder titledBorder)
  7. getBorder(String title)
  8. getBorderInsetsForNoComponent(Border border)
  9. getCompoundBorder(String text)