Java JPanel Create createBlankColorPanel(int height, int width, Color bkColor)

Here you can find the source of createBlankColorPanel(int height, int width, Color bkColor)

Description

create Blank Color Panel

License

Open Source License

Declaration

public static JPanel createBlankColorPanel(int height, int width, Color bkColor) 

Method Source Code


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

import java.awt.Color;
import java.awt.Insets;

import javax.swing.JPanel;

import javax.swing.border.EmptyBorder;

public class Main {
    public static JPanel createBlankColorPanel(int inset, Color bkColor) {
        JPanel pane = new JPanel();
        pane.setBorder(new EmptyBorder(new Insets(inset, inset, inset, inset)));

        pane.setBackground(bkColor);//from  w  ww .  ja v  a2s .  com

        return pane;
    }

    public static JPanel createBlankColorPanel(int height, int width, Color bkColor) {
        JPanel pane = new JPanel();
        pane.setBorder(new EmptyBorder(new Insets(height, width, height, width)));

        pane.setBackground(bkColor);

        return pane;
    }
}

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()