Answer the question
In order to leave comments, you need to log in
How to block paintComponent() method call?
I want to lock the panel where the drawing is going on. setIgnoreRepaint(true) - doesn't work, I call it in the frame constructor; the frame wraps this drawing panel.
DrawCanvas canvas = new DrawCanvas();
class DrawCanvas extends JPanel {
@Override
public void paintComponent(Graphics g) { // invoke via repaint()
super.paintComponent(g); // fill background
//drawing
}
canvas.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) { // mouse-clicked handler
//some code :)
// Refresh the drawing canvas
repaint(); // Call-back paintComponent().
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question