Here you can find the source of createJPanel(String name, LayoutManager lm, ComponentListener cl)
Parameter | Description |
---|---|
name | JPanel name. |
lm | Panel LayoutManager |
cl | A ComponentListner for handling events |
public static JPanel createJPanel(String name, LayoutManager lm, ComponentListener cl)
//package com.java2s; //License from project: Open Source License import java.awt.LayoutManager; import java.awt.event.ComponentListener; import javax.swing.JPanel; public class Main { /**/* ww w.j a v a2 s.co m*/ * Auxiliar method for creating a named JPanel object. * * @param name JPanel name. * @param lm Panel LayoutManager * @param cl A ComponentListner for handling events * @return The named JPanel. */ public static JPanel createJPanel(String name, LayoutManager lm, ComponentListener cl) { JPanel jp; if (lm != null) { jp = new JPanel(lm); } else { jp = new JPanel(); } jp.setName(name); jp.addComponentListener(cl); return jp; } /** * Auxiliar method for creating a named JPanel object. * * @param name JPanel name. * @param cl A ComponentListner for handling events * @return The named JPanel. */ public static JPanel createJPanel(String name, ComponentListener cl) { return createJPanel(name, null, cl); } }