private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {
alert();
if(flaga_button==true){
try {
// System.out.print("test");
// BufferedImage input = toBufferedImage(dst);
// File file=new File();
// BufferedImage bimage = ImageIO.read(file);
filtr_alpha();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
//int transparency = Transparency.TRANSLUCENT;
GraphicsDevice gs = ge.getDefaultScreenDevice();
/* GraphicsConfigTemplate gct=new GraphicsConfigTemplate() {
@Override
public GraphicsConfiguration getBestConfiguration(GraphicsConfiguration[] gc) {
}
@Override
public boolean isGraphicsConfigSupported(GraphicsConfiguration gc) {
gc.
throw new UnsupportedOperationException("Not supported yet.");
}
};*/
GraphicsConfiguration gc = (new myPanel()).getGraphicsConfiguration();
// panel=new myPanel();
jInternalFrame1.addNotify();
(new myPanel()).addNotify();
ImageCapabilities ic=dst.getCapabilities(gc);
// jInternalFrame1.add(gc);
new myPanel().add(new myPanel());
panel=new myPanel();
panel.addNotify();
myPanel mp=new myPanel();
con.add(mp);
System.out.println(mp.getGraphicsConfiguration());
// ((new myPanel()).getGraphicsConfiguration());
// gc.createCompatibleVolatileImage(dst.getWidth(null), dst.getHeight(null), ic)
BufferedImage input = (mp.getGraphicsConfiguration()).createCompatibleImage(500, 500,BufferedImage.TYPE_INT_RGB);
// System.out.println("dwadwa"+input.toString());
System.out.println(dst);
Graphics bg = input.getGraphics(); //ustawic na dst wrazie czego
bg.drawImage(dst, 0, 0, null);
bg.dispose();
// BufferedImage input =convert(graf);
// System.out.println(file.getPath().toString());
// Create the buffered image
//(BufferedImage) dst;
// JAI.create("filestore", dst, "image.jpg", "JPEG");
// File inputFile = new File(dst.getGraphics().);
// BufferedImage input = ImageIO.read(inputFile);
File outputFile = file;
if (outputFile == null) {
System.err.println("prosze wybrać obrazek");
} else {
ImageIO.write(input, "JPG", outputFile);
}
} catch (IOException ex) {
Logger.getLogger(ImageViewView.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
pomoże ktoś?