Java JPanel Create createPaletteJPanel(String title)

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

Description

Create a panel with a border and title

License

Open Source License

Parameter

Parameter Description
title the title of the panel (null allowed)

Return

the panel that got created

Declaration

public static JPanel createPaletteJPanel(String title) 

Method Source Code

//package com.java2s;

import java.awt.GridLayout;

import javax.swing.BorderFactory;

import javax.swing.JPanel;

public class Main {
    /**/*from  w  ww.  ja v  a2s.  co  m*/
     * Create a panel with a border and title
     * 
     * @param title the title of the panel (null allowed)
     * @return the panel that got created
     */
    public static JPanel createPaletteJPanel(String title) {
        JPanel panel = new JPanel();

        if (title != null) {
            panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), title));
        } else {
            panel.setBorder(BorderFactory.createEtchedBorder());
        }

        panel.setLayout(new GridLayout(0, 1));
        return panel;
    }
}

Related

  1. createCenteredWindow(String title, Dimension size, JPanel panel, boolean exitOnClose)
  2. createFlowJPanelLeft(JComponent parent, int alignment)
  3. createGridedJPanel(JComponent parent, int columns)
  4. createJPanel()
  5. createJPanel(String name, LayoutManager lm, ComponentListener cl)
  6. createStandardJPanel()
  7. createVerticalBoxJPanel(JComponent parent)
  8. initPanel(Color color)
  9. newJPanel(Component... c)