Java examples for Swing:JPanel
Returns a JPanel with the specified component nested inside it
//package com.java2s; import javax.swing.JComponent; import javax.swing.JPanel; public class Main { /**//from w w w.ja v a 2 s .c om * Returns a JPanel with the specified component nested inside it * @param toNest The component to nest in a new JPanel * @return A new JPanel with the component added inside it */ public static JPanel nestInPanel(JComponent toNest) { JPanel container = new JPanel(); container.add(toNest); return container; } }