I would like to do some drawing into a large BufferedImage and later show that in a JFrame with a JScrollPane. I tried the following approach
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
public class FrameImage {
    private static void createAndShowGUI() {
       BufferedImage image;
       Graphics bufG;
       JFrame frame;
       JPanel panel;
       JLabel picLabel;
       frame = new JFrame("FrameTest");
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       image=new BufferedImage(400, 300, BufferedImage.TYPE_INT_ARGB);
       bufG=image.createGraphics();
       bufG.setColor(Color.red);
       bufG.drawString("Testing",100,100);
       panel = new JPanel();
       panel.setBackground(Color.BLUE);
       panel.setPreferredSize(new Dimension(1500, 1500));
       panel.setLayout(null);
       picLabel = new JLabel(new ImageIcon(image));
       panel.add(picLabel);
       frame.add(new JScrollPane(panel));
       frame.setVisible(true);
       frame.setSize(800, 500);
    }
    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }
}
But the text "Testing" does not show up in my JFrame. What am I missing here?
 
     
    