Java Swing TitledBorder createInsetTitledBorder(String title)

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

Description

create Inset Titled Border

License

Open Source License

Declaration

public static Border createInsetTitledBorder(String title) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014 Open Door Logistics (www.opendoorlogistics.com)
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v3
 * which accompanies this distribution, and is available at http://www.gnu.org/licenses/lgpl.txt
 ******************************************************************************/

import java.awt.Color;

import java.awt.Font;

import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;

public class Main {
    private static final Font BORDER_FONT = new Font(Font.SANS_SERIF, Font.BOLD, 13);

    public static Border createInsetTitledBorder(String title) {
        return BorderFactory.createCompoundBorder(
                new TitledBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 2), title,
                        TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, BORDER_FONT),
                BorderFactory.createEmptyBorder(5, 5, 5, 5));
    }//w ww . jav a  2 s .  c  om
}

Related

  1. createBorder(String title)
  2. createBorder(String title)
  3. createBorderedPanel(String title, int margin)
  4. createGroupBorder(String title)
  5. createGuiElementBorder(final String title)
  6. createStyleAttributeBorder(String title)
  7. createTitleBorder(final String title)
  8. createTitledBorder(final String title)
  9. createTitledBorder(String label)