Witam
Mój problem polega na tym ze zamiast pobierać obraz z płótna pobiera z background frema
i nie mam zielonego pojęcia dlaczego tak się dzieje :)
Za wszelka pomoc z góry dziękuje

oto program

import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;

public class  Obraz extends Frame implements ItemListener 
{

Button b1;
Canvas Plutno ;
int x,y;
int w=400,h=400;
boolean stan=false;
Color kolor=Color.red; 
List listaKolorow;

public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
 }   

    Obraz()
    {
    super("Obraz");
    setSize(500,500);
    setResizable(false); 
    GrafInte();

    }
      public void GrafInte()
      {
    setLayout(new BorderLayout());
    Panel kontrola1 = new Panel();
    Panel kontrola2 = new Panel();
    b1 = new Button("Save");
    Plutno =new Canvas();
    listaKolorow = new List(4, false);
    listaKolorow.add("Czarny");
    listaKolorow.add("Czerwony");
    listaKolorow.add("Niebieski");
    listaKolorow.add("Zolty");
    listaKolorow.add("Zielony");
    listaKolorow.add("Brazowy");

    Plutno.setSize(h,w);
    Plutno.setBackground(Color.white);

    kontrola1.add(b1);
    kontrola1.add(listaKolorow);
    kontrola2.add(Plutno);

    add(kontrola1,BorderLayout.SOUTH);
    add(kontrola2,BorderLayout.CENTER);
    b1.addActionListener(new B1());
    listaKolorow.addItemListener(this);

    Plutno.addMouseMotionListener(new MouseMotionAdapter()
        { 
        public void mouseDragged(MouseEvent e)
            {
            x = e.getX();
            y = e.getY(); 
            //setForeground(Color.black);

            Plutno.getGraphics().fillOval(x,y,5,5);

            //repaint();

            }
        });
    }

        private void save(BufferedImage image) {
        String ext = "jpg";  
        File file = new File("Image." + ext);
        try {
            ImageIO.write(image, ext, file);
        } catch(IOException e) {
            System.out.println("write error: " + e.getMessage());
        }
    }

 private BufferedImage makeImage(Canvas Plutno) {

        int type = BufferedImage.TYPE_INT_RGB;
        BufferedImage image = new BufferedImage(w,h,type);
        Graphics g2 = image.createGraphics();

        Plutno.paint(g2);
        g2.dispose();
        return image;
    }

    class B1 implements ActionListener 
    {
        public void actionPerformed(ActionEvent e) 
        {

           save(makeImage(Plutno));

        }
    }

        public void itemStateChanged(ItemEvent event)
        {
         Object source=event.getSource();

        if (listaKolorow.getSelectedIndex() ==0)
            {
            setForeground(Color.black);
            repaint();

            }if (listaKolorow.getSelectedIndex() ==1)
            {

            setForeground(Color.red);

            repaint();

            }if (listaKolorow.getSelectedIndex() ==2)
            {
            setForeground(Color.blue);
            repaint();
            }if (listaKolorow.getSelectedIndex() ==3)
            {
            setForeground(Color.yellow);
            repaint();
            }if (listaKolorow.getSelectedIndex() ==4)
            {
            setForeground(Color.green);
            repaint();
            }if (listaKolorow.getSelectedIndex() ==5)
            {
            setForeground(Color.pink);
            repaint();
            }

        }

public static void main(String args[])
{

Frame Okno=new Obraz();
Okno.setBackground(Color.black);

    Okno.addWindowListener(new WindowAdapter()
    {
        public void windowClosing(WindowEvent e)
        {
        System.out.println("Dziekujemy za prace z programem...");
        System.exit(0);
        }

    });

Okno.setVisible(true);
}
}

</asm>