The first example (except that it's Canvas.repaint(), not refresh()) doesn't do software rendering but uses the hardware renderer. Only the second one is software. I guess that's why i don't fully understand the question.
Anyway, they are not doing the same thing. The first one uses passive rendering, the second one active. I.e. in the second example, the pixels are being painted when you call display(g). You can rely on that after the call, the Panel shows the current frame. This isn't the case in the first example. repaint() just schedules the component for a repaint, it doesn't actually paint anything. Painting is done in the awt event dispatch thread when the VM thinks it's time to.
Ignoring the fact that we are comparing apples (software) to bananas (hardware) here, the former way of doing things is mandatory when using a GLCanvasRenderer and usefull for frames that should integrate into Swing/AWT-GUIs (by putting the display(g) call into the paint()-method of the component) when using software rendering.
The latter way is better when using software rendering without any further GUI elements because it gives you total control of what to paint when.