Wiatam mam problem, potrzebuje zawartość Panela DrawArea wpakować do BufferedImage, mam taki kod:

import java.awt.* ;
import java.awt.event.* ;
import java.awt.image.* ;
import javax.imageio.*;
import java.io.*;
import javax.swing.*;
/**
 *
 * @author mitrydates
 */
public class ocrWindow extends Frame{
    int x,y;
    Panel drawArea ;
    int drawPoints[][] = new int[10][20] ;

    public ocrWindow(){
        this.addWindowListener(new ocrWindowAdapter());
        this.setSize(500, 500);

        Panel buttonPanel = new Panel();
        Panel drawPanel = new Panel() ;

        buttonPanel.setBackground(Color.BLUE);
        buttonPanel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

        Button bClear = new Button("clear") ;
        ButtonClearAdapter bC = new ButtonClearAdapter();
        bClear.addActionListener(bC);

        Button bOk = new Button("OK");
        ButtonOkAdapter bO = new ButtonOkAdapter();
        bOk.addActionListener(bO);

        buttonPanel.add(bClear);
        buttonPanel.add(bOk) ;

        BorderLayout inL = new BorderLayout();
        inL.setHgap(140);
        inL.setVgap(140);
        drawPanel.setLayout(inL);
        drawArea = new Panel() ;
        drawArea.setBackground(Color.GRAY);

        drawPanel.add(new Panel(),BorderLayout.NORTH);
        drawPanel.add(new Panel(),BorderLayout.SOUTH);
        drawPanel.add(new Panel(),BorderLayout.WEST);
        drawPanel.add(new Panel(),BorderLayout.EAST);

        drawPanel.add(drawArea,BorderLayout.CENTER  );
        drawPanel.setBackground(Color.CYAN);

        drawAreaAdapter drow = new drawAreaAdapter();
        drawArea.addMouseListener(drow);
        drawArea.addMouseMotionListener(drow);

        this.setLayout(new BorderLayout());
        this.add(buttonPanel,BorderLayout.SOUTH );
        this.add(drawPanel,BorderLayout.CENTER );

        //mainWindow.pack();
        this.setVisible(true);
    }
     /*
     * 
     * function add point to Draw area and table
     * 
     */ 
    public void addPoint(int x, int y){

        Graphics g = drawArea.getGraphics() ;
        g.setColor(Color.RED);
        g.drawLine(this.x, this.y, x, y);
        this.x = x;
        this.y = y;
    }
     /*
     * 
     * function clear draw area
     * 
     */ 
    public void clearDrawArea(){
        Graphics g = drawArea.getGraphics() ;
        g.clearRect(0, 0, drawArea.getWidth() ,drawArea.getHeight() );
    }
    public void computDrawArea(){
        //Graphics g = drawArea.getGraphics() ;
        //Graphics2D g2d = (Graphics2D)drawArea.getGraphics() ;
        //g2d.setBackground(Color.GRAY);
        //g2d.setColor(Color.BLACK);
        //g2d.drawString("ggg", 10, 10);
        //g2d.scale(0.5, 0.5);
        //g2d.drawString("hhh", 5, 5);
        //g2d.
        //BufferedImage bI = new BufferedImage(drawArea.getWidth(),drawArea.getHeight(),BufferedImage.TYPE_BYTE_BINARY);

BufferedImage bi = new BufferedImage(drawArea.getWidth(),
drawArea.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics2D g = (Graphics2D)bi.createGraphics();
//g.setBackground(Color.WHITE);
//drawArea.pa
//g.setBackground(Color.GRAY);
//g.setColor(Color.RED);
//g.clearRect(0, 0, drawArea.getWidth(), drawArea.getHeight());
//g.drawString("gg", 10, 10);
drawArea.paint(g);
//g.scale(0.5, 0.5) ;
g.dispose();
        try {
          ImageIO.write(bi, "png", new File("twopanels.png"));
        }
        catch(IOException ioe) {
          System.out.println(ioe.getMessage());
        }
//drawArea.paintComponent(g);

//        BufferedImage bI = drawArea.getGraphicsConfiguration().createCompatibleImage(drawArea.getWidth(), drawArea.getHeight());
  //      Graphics2D g2db = (Graphics2D)bI.getGraphics() ;
    //    g2db.setBackground(Color.GRAY);
      //  g2db.setColor(Color.WHITE);
        //g2db.drawString("xxx", 10, 10);
        Graphics2D g2d = (Graphics2D)drawArea.getGraphics() ;
        g2d.drawImage(bi, 0, 0, null);
        //g.drawImage(bI, 0, 0, null);
        // Graphics2D bIg2d = (Graphics2D)bI.getGraphics() ;
      //  bIg2d.drawImage(g2d, 0, 0, null);
        //drawArea.
        //bIg2d = (Graphics2D)g2d.create() ;
        //bI
        //g.setClip() ;
        //drawPoints ;
    }
     /*
     * 
     * Function start application 
     * 
     */ 
    public static void main(String args[]){

        ocrWindow mainWindow =  new ocrWindow();

    }
     /*
     * 
     * function set insets in BorderLayout
     * 
     */ 
    public Insets getInsets(){
        return new Insets(50, 50, 50, 50);
    }
     /*
     * 
     * class catch window actions like drawing 
     * 
     */
    class ocrWindowAdapter extends WindowAdapter {
        public void windowClosing(WindowEvent ev){
            System.exit(0);
        }
    }// ocrWindowAdapter
    /*
     * 
     * class catch draw area actions like drawing 
     * 
     */
    class drawAreaAdapter extends MouseAdapter {
        public void mouseClicked(MouseEvent me){
        //    add();
            //repaint() ;
        }
        public void mouseReleased(MouseEvent me){
          //  start = false ;
        }
        public void mousePressed(MouseEvent me){
            x = me.getX() ;
            y = me.getY() ;
            //add() ;
        }
        public void mouseDragged(MouseEvent me){
            addPoint(me.getX(), me.getY()) ;
        }
    }// end class drawAreaAdapter
     /*
     * 
     * class catch button CLEAR actions 
     * 
     */ 
    class ButtonClearAdapter implements ActionListener {

        public void actionPerformed(ActionEvent ae){
            clearDrawArea();
        }
    }// ButtonClearAdapter
         /*
     * 
     * class catch button CLEAR actions 
     * 
     */ 
    class ButtonOkAdapter implements ActionListener {

        public void actionPerformed(ActionEvent ae){
            computDrawArea();
        }
    }// ButtonClearAdapter
}

Musicie coś narysować w szarym panelu na srodku po czym nacisnac OK

tutaj uruchamiana jest funkcja computDrawArea ma ona przeliczać różne bzdury ale to później na poczatek chce z Panelu zczytać dane do BufferedImage ale gdy zrobie:
Panel.paint(g) ;
dostaje tylko czarny kwadrat bez narysowanej zawartosci :).