I hear what your saying.
You can indeed repaint only a section of area.
In the "Performing Custom Painting Examples" on the Sun website, I found a useful example which shows how to draw a dragged rectangle, and then only repaint that area when the mouse is moving or released.
Here is the relevant section of code...
public void mouseDragged(MouseEvent e) {
updateSize(e);
}
public void mouseReleased(MouseEvent e) {
updateSize(e);
}
/*
* Update the size of the current rectangle
* and call repaint. Because currentRect
* always has the same origin, translate it
* if the width or height is negative.
*
* For efficiency (though
* that isn't an issue for this program),
* specify the painting region using arguments
* to the repaint() call.
*
*/
void updateSize(MouseEvent e) {
int x = e.getX();
int y = e.getY();
currentRect.setSize(x - currentRect.x,
y - currentRect.y);
updateDrawableRect(getWidth(), getHeight());
Rectangle totalRepaint = rectToDraw.union(previousRectDrawn);
repaint(totalRepaint.x, totalRepaint.y,
totalRepaint.width, totalRepaint.height);
}
This code is subject to copyright (see here for full code and copyright notice)
See here for further example listings
Truth be told, I'm having a similar issue on FPS, but that may be due to my currently poor code! I've learnt so much over the past few months, that I can now make my code so more efficient. Hopefully I can overcome the FPS issue when more than 2 "people" slow down my graphics! Hummmm...
I have only implemented the above code for the same section in my code, and not others, but by all means give it a try!