Java examples for Swing:JPanel
Creates a new instance of a JPanel and sets the opacity of the panel to 0.
//package com.java2s; import javax.swing.*; import java.awt.*; public class Main { /**//from w w w . ja v a 2 s. c om * Creates a new instance of a {@link JPanel} and sets the opacity of the panel to 0. Transparent {@link JPanel}s * are useful to allow components below them to display color or content. * * @param components any components that should be added to the given JPanel upon creation * @return a transparent {@link JPanel} */ public static JPanel createTransparentJPanel(Component... components) { JPanel panel = new JPanel(); panel.setOpaque(false); for (Component component : components) { panel.add(component); } return panel; } }