, .
.
" " - Sun , , , , .
...
public void mouseDragged(MouseEvent e) {
updateSize(e);
}
public void mouseReleased(MouseEvent e) {
updateSize(e);
}
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);
}
(. )
.
In truth, I have a similar problem with FPS, but that might be due to my bad code at the moment! I've learned so much over the past few months that I can now make my code more efficient. I hope I can overcome the FPS problem when more than 2 "people" slow down my schedule! Hummmm ... I just implemented the above code for the same section in my code and not in others, but by all means try!
source
share