This is an example of the Java Swing application I've wrote. I'm trying to follow the first Effective Java items. I wrote some classes similar so I've posted only this class for the review.package com.ELSE.view;import java.awt.BorderLayout;import java.awt.Color;import javax.swing.JPanel;import javax.swing.border.EmptyBorder;class Bar {    private static JPanel parent, left, right;    private Bar() {        parent = new JPanel();        parent.setBackground(Color.decode(#cbc4a7));        parent.setBorder(new EmptyBorder(10, 10, 10, 10));        parent.setLayout(new BorderLayout());        left = JInvisiblePanel.getInstance(parent);        right = JInvisiblePanel.getInstance(parent);        parent.add(left, BorderLayout.WEST);        parent.add(right, BorderLayout.EAST);    }    static Bar getInstance() {        return new Bar();    }    public JPanel getParent() {        return parent;    }    public JPanel getLeft() {        return left;    }    public JPanel getRight() {        return right;    }}I add the JInvisiblePanel just for showing (no need to review) as it's similar to Bar.java:package com.ELSE.view;import java.awt.Component;import javax.swing.JPanel;class JInvisiblePanel {  private JInvisiblePanel() {      throw new AssertionError();  }  public static JPanel getInstance(Component component) {      JPanel panel = new JPanel();      panel.setBackground(component.getBackground());      return panel;  }}And some code that uses the class as example (neither to review):Bar panel = Bar.getInstance();JButton settings = new Button(MenuBar.class.getResource(/settings.png));panel.getLeft().add(settings);SearchBar searchBar = new SearchBar(); panel.getRight().add(searchBar);
Customized JPanel desing pattern
java;object oriented;design patterns;swing;gui