package alphachannel;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Test {
public static void main(String[] args) throws Exception {
JFrame frame = new JFrame("Test");
URL transPng = new URL("http://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png");
Image image = ImageIO.read(transPng);
ImagePanel tmp;
tmp=new ImagePanel();
}
private class ImagePanel extends JPanel{
private BufferedImage image;
public ImagePanel() {
try {
image = ImageIO.read(new File("rwraa"));
} catch (IOException ex) {
// handle exception...
}
}
@Override
public void paintComponent(Graphics g) {
g.drawImage(image, 0, 0, null); // see javadoc for more info on the parameters
}
}
}
Linia tmp=new ImagePanel(); wypluwa mi (jeszcze w edytorze) "non-static variable this cannot be referenced from a static context"
ze niby gdzie ja tu mam powołanie się na this ;/;/;/;/;/;/