Graphics in Swing

how to draw graphics in Swing?..like in Applets we use g.drawLine() or g.drawRect()...what is the way to do similar action in Swing?
[139 byte] By [Amaresh.mouryaa] at [2007-11-27 5:30:11]
# 1

Override the paintComponents method in your component and there you get a Graphics2D object:

public void paintComponent(Graphics g){

Graphics2D g2d = (Graphics2D)g;

// do your paint here

}

Do not call this method to repaint your component, do so by calling "repaint()"):

yourComponent.repaint()

vicente.reiga at 2007-7-12 14:54:01 > top of Java-index,Desktop,Core GUI APIs...