Hey i have a halftransparent image and i want to paint it in a jframe without any borders but the problem is i always see the background of the frame throught the picture not the screen behind the frame like my desktop .
So here is my code :
bothe methodes doesnt work so please help me :D
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.image.BufferedImage;
import javax.imageio.*;
import java.net.*;
import java.io.*;
import java.awt.Graphics2D;
import javax.swing.*;
import java.awt.*;
public class test extends Actor
{
public static void test1() throws Exception
{
BufferedImage Image = ImageIO.read(new File("C:\\Users\\Marc\\Desktop\\Bilder\\Kreis.png"));
JFrame frame = new JFrame();
frame.setUndecorated(true);
frame.setOpacity(1.0f);
frame.getContentPane().setLayout(new FlowLayout());
frame.getContentPane().add(new JLabel(new ImageIcon(Image)));
frame.pack();
frame.setVisible(true);
}
public static void test2() {
JPanel p = new JPanel();
p.setLayout(null);
p.setForeground(Color.blue);
p.setBackground(Color.black);
p.setOpaque(true);
p.setBounds(0, 0, 100, 100);
JFrame f = new JFrame("Two Panels");
f.setContentPane(p);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(300, 300);
f.setUndecorated(true);
f.setLocationRelativeTo(null);
f.setVisible(true);
}
}

