/** * Create an overlay. * <p> * An "alpha-compatible" graphics configuration will be used when creating the window so as to enable a transparent * overlay. * * @param owner owning window, must not be <code>null</code> * @throws IllegalArgumentException if the <code>owner</code> parameter is <code>null</code> */ public AbstractJWindowOverlayComponent(Window owner) { this(owner, WindowUtils.getAlphaCompatibleGraphicsConfiguration()); }
public Overlay(Window owner) { super(owner, WindowUtils.getAlphaCompatibleGraphicsConfiguration()); setBackground(new Color(0, 0, 0, 0)); // This is what you do in JDK7 setLayout(null); JButton b = new JButton("JButton"); b.setBounds(150, 150, 100, 24); add(b); TranslucentComponent c = new TranslucentComponent(); c.setBounds(150, 200, 300, 40); add(c); }