it became necessary to display opaque graphics on a transparent Jframe using BufferStrategy (if at all possible).

public class TransFrame extends JFrame { BufferStrategy bufs; public TransFrame() { this.setSize(500, 500); this.setLocationRelativeTo(null); this.setUndecorated(true); this.setBackground(new Color(0, 0, 0, 255)); this.setIgnoreRepaint(true); this.setDefaultCloseOperation(TransFrame.EXIT_ON_CLOSE); this.setVisible(true); this.createBufferStrategy(2); bufs = getBufferStrategy(); Timer t = new Timer(1000 / 30, new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { render(); } }); t.start(); } public void render() { Graphics2D gr = (Graphics2D) bufs.getDrawGraphics(); gr.setColor(Color.RED); gr.fillRect(0, 0, 300, 300); gr.dispose(); bufs.show(); } } 

enter image description here

Everything is drawn, but when I change the transparency of the Background, the graphics disappear ...

enter image description here

What am I doing wrong?

    0