Java Utililty Methods JPanel Create

List of utility methods to do JPanel Create

Description

The list of methods to do JPanel Create are organized into topic(s).

Method

JPanelcreateBlankColorPanel(int height, int width, Color bkColor)
create Blank Color Panel
JPanel pane = new JPanel();
pane.setBorder(new EmptyBorder(new Insets(height, width, height, width)));
pane.setBackground(bkColor);
return pane;
JFramecreateCenteredWindow(String title, Dimension size, JPanel panel, boolean exitOnClose)
Create a simple centered window(JFrame).
JFrame frame = new JFrame(title);
frame.setSize(size);
frame.setPreferredSize(size);
if (exitOnClose)
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
else
    frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
frame.add(panel);
...
JPanelcreateFlowJPanelLeft(JComponent parent, int alignment)
create Flow J Panel Left
JPanel panel = new JPanel(new FlowLayout(alignment, 0, 3));
parent.add(panel);
return panel;
JPanelcreateGridedJPanel(JComponent parent, int columns)
create Grided J Panel
JPanel panel = new JPanel(new GridLayout(0, columns));
parent.add(panel);
return panel;
JPanelcreateJPanel()
create J Panel
JPanel panel = new JPanel();
panel.setOpaque(false);
return panel;
JPanelcreateJPanel(String name, LayoutManager lm, ComponentListener cl)
Auxiliar method for creating a named JPanel object.
JPanel jp;
if (lm != null) {
    jp = new JPanel(lm);
} else {
    jp = new JPanel();
jp.setName(name);
jp.addComponentListener(cl);
...
JPanelcreatePaletteJPanel(String title)
Create a panel with a border and 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;
...
JPanelcreateStandardJPanel()
create Standard J Panel
JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createEmptyBorder());
panel.setLayout(new BorderLayout());
return panel;
JPanelcreateVerticalBoxJPanel(JComponent parent)
create Vertical Box J Panel
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
parent.add(panel);
return panel;
JPanelinitPanel(Color color)
Creates a gridbag layout panel
JPanel result = new JPanel();
result.setBackground(color);
result.setLayout(new GridBagLayout());
return result;