[JAVA SWING] pb affichage
Bonjour,
J'ai un panel sur lequel je change l'affichage en fonction de certains evenements, cela fonctionne pas trop mal, sauf lorsque j'affiche une image, ej en la vois rapidement que lorsque je pesse sur mon dessin!! est ce un pb de refresh!!!
voici ma methoide paintCOmponent qui me permet de mettre l'image en autres :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| public void paintComponent(Graphics g) {
Graphics gPanel = this.p.getGraphics();
if (event == false){
this.p.setBorder(new LineBorder(EndPointView.endpointOK, 2, true));
}
else {
this.p.setBorder(new LineBorder(EndPointView.endpointNOT_OK, 5,
true));
Graphics gp = imagePanel.getGraphics();
Image image = new ImageIcon(Toolkit.getDefaultToolkit()
.getImage(
getClass().getClassLoader().getResource(
"images/alert.JPG"))).getImage();
BufferedImage bi = new BufferedImage(this.imagePanel.getWidth(),
this.imagePanel.getHeight(), BufferedImage.TYPE_INT_RGB);
gp.drawImage(image, 0, 0, null);
// TODO:event = false
}
// super.paintComponents(g);
// TODO a tester
//this.getParent().getParent().getParent().repaint();
} |
merci!!