Java Swing TitledBorder addMarginBorder(JPanel panel, String title, int top, int left, int bottom, int right)

Here you can find the source of addMarginBorder(JPanel panel, String title, int top, int left, int bottom, int right)

Description

add Margin Border

License

Open Source License

Declaration

public static void addMarginBorder(JPanel panel, String title, int top, int left, int bottom, int right) 

Method Source Code

//package com.java2s;

import javax.swing.BorderFactory;

import javax.swing.JPanel;

import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;

public class Main {
    public static void addMarginBorder(JPanel panel, String title, int top, int left, int bottom, int right) {
        Border border = BorderFactory.createTitledBorder(title);
        Border marginBorder = new EmptyBorder(top, left, bottom, right);
        panel.setBorder(new CompoundBorder(marginBorder, border));
    }//from   ww  w.j a v a2  s . c  om
}

Related

  1. borderTitle(JComponent component, String title)
  2. buildInfoPanelTextBorder(final JLabel content, final String title)
  3. buildInfoPanelTextBorderScroll(final JComponent content, final String title)
  4. buildLabeledBorder(String label)