I am trying to create an X/O game and in that i am not able to call drawString() when user clicks on the required position. I am able to display grid and take mouse co-ordinated where user clicks but i am not able to call repaint() or call update() "X" and "O" on that. Please help.Thanks
Don't override update(...). There is no need to do that in Swing.
Don't use two Lists for the painting location. Instead you can use an ArrayList that stores a Point object, which contains both x/y values:
Don't use the MouseInfo class. That will return the mouse location relative to the screen. You want the mouse location relative to the panel, since you are doing your painting on the panel, not the screen.
Instead you can use e.getPoint() and add the point to the points ArrayList
Don't invoke getGraphics or invoke update(...) directly. Swing will do all this for you when a component needs to be repainted.
The drawString(...) method paints the text above and to the right of the point specified. So you will need to adjust the x/y values so the character is painted in the center of your grid. You can use the Graphics.getFontMetrics() to get information about the size of the text.
Don't know if that is everything, but it is a start.
That is a really big piece of pie for such a tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book