List of utility methods to do JPanel Create
JPanel | createBlankColorPanel(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; |
JFrame | createCenteredWindow(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); ... |
JPanel | createFlowJPanelLeft(JComponent parent, int alignment) create Flow J Panel Left JPanel panel = new JPanel(new FlowLayout(alignment, 0, 3)); parent.add(panel); return panel; |
JPanel | createGridedJPanel(JComponent parent, int columns) create Grided J Panel JPanel panel = new JPanel(new GridLayout(0, columns)); parent.add(panel); return panel; |
JPanel | createJPanel() create J Panel JPanel panel = new JPanel(); panel.setOpaque(false); return panel; |
JPanel | createJPanel(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); ... |
JPanel | createPaletteJPanel(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; ... |
JPanel | createStandardJPanel() create Standard J Panel JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder()); panel.setLayout(new BorderLayout()); return panel; |
JPanel | createVerticalBoxJPanel(JComponent parent) create Vertical Box J Panel JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); parent.add(panel); return panel; |
JPanel | initPanel(Color color) Creates a gridbag layout panel JPanel result = new JPanel(); result.setBackground(color); result.setLayout(new GridBagLayout()); return result; |