Chce narysowac obrazki przed pojawieniem sie panelu, tzn. jak juz uruchomie projekt, otworzy sie panel, to obrazki moje maja juz na nim byc. Mam taki panel:

to ponizej nie dziala:( :

public class klasa extends javax.swing.JPanel {

    Image obrazki[];

    /** Creates new form klasa*/
    public klasa() {

        MediaTracker mt = new MediaTracker(this);
        Toolkit toolkit = Toolkit.getDefaultToolkit();

        obrazki = new Image[3];
        for(int i=0; i<3; i++)
        {
            obrazki[i] = toolkit.getImage("obrazek.png");
            mt.addImage(obrazki[i], i);
        }

        try {
            mt.waitForID(0);
            mt.waitForID(1);
            mt.waitForID(2);
        } catch (java.lang.InterruptedException e) {System.out.println("Nie można załadować obrazka/ów.");}

        initComponents();

    }

    @Override
    public void paintComponent(Graphics g)
    {
        super.paintComponent(g);
        g.drawImage(obrazki[0], 10, 20, this);
        g.drawImage(obrazki[1], 101, 202, this);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>                        
    // Variables declaration - do not modify                     
    // End of variables declaration                   
}