Java examples for Swing:JFrame
Using a Uniform Translucent JFrame
import java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class Main extends JFrame { private JButton closeButton = new JButton("Close"); public Main(String title) { super(title); initFrame();// w w w .ja v a 2 s. c o m } public void initFrame() { setDefaultCloseOperation(EXIT_ON_CLOSE); setUndecorated(true); setOpacity(0.40f); setSize(200, 200); setLocationRelativeTo(null); add(closeButton, BorderLayout.SOUTH); closeButton.addActionListener(e -> System.exit(0)); } public static void main(String[] args) { Main frame = new Main("Translucent Frame"); frame.setVisible(true); } }