That depends on how the line was drawn...
Usually, graphics are drawn in the components paint() method ( or other methods called from the paint method... ) so the simple explanation is just don't paint the line anymore.
Then call repaint().
It doesn't make sense to "delete" a line... since graphics are continually being redrawn, why would you waste the time to tell the graphics context to draw a line and then erase it... the end result is the line is not there... so you shouldn't draw it in the first place...