Java Swing TitledBorder setPanelBorder(final JPanel p, final String s)

Here you can find the source of setPanelBorder(final JPanel p, final String s)

Description

Set Border of JPanel.

License

Open Source License

Parameter

Parameter Description
p panel
s string

Declaration

public static void setPanelBorder(final JPanel p, final String s) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.BorderFactory;

import javax.swing.JPanel;

public class Main {
    /**//  w w  w.  jav a  2 s .com
     * Set Border of JPanel.
     * @param p panel
     * @param s string 
     */
    public static void setPanelBorder(final JPanel p, final String s) {
        p.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(s),
                BorderFactory.createEmptyBorder(5, 5, 5, 5)));
    }
}

Related

  1. myBorder(String title)
  2. setBoldTitledBorder(String title, JComponent p)
  3. setBorder(Container panel, String title)
  4. setBorder(JComponent component, String text, int titleJustification)
  5. setLabelBorder(String label, JComponent c)
  6. setTitleBorder(JComponent pane, String title)
  7. titledBorder(String title, B comp)
  8. withTitledBorder(String title, JComponent c)