Hi, people!
I need help!
I have simple programm that paints polygons on Panel using coordinates from database..
It takes a lot of time.
BUT if another window is puted on my programm and the "went" out, the image deleted!
How to make my programm automatic repainting not using database (its too long). I want SYSTEM only to redraw picture on Panel.
May be I should set some property?
Automatic repainting..
Moderatoren:crack, Marwin, Krüsty
- Marwin
- Moderator
- Beiträge:307
- Registriert:Donnerstag 8. Mai 2003, 21:19
- Wohnort:Seelow, Deutschland
- Kontaktdaten:
Hi Ignat 
Ive searched but I found nothing until now. What is too slow, the painting-routine or the database querys? If the last one is the problem you could fetch the coordinates one time to save them in an array. After this you read the data every time from this array. If the first point is the problem, then try to save to created picture in an array (or something else, in Basic I do this by using an array
. Maybe there is a better data type in Java.). Then, if the paint-method is invoked you just draw the saved picture to your Panel.
Marwin

Ive searched but I found nothing until now. What is too slow, the painting-routine or the database querys? If the last one is the problem you could fetch the coordinates one time to save them in an array. After this you read the data every time from this array. If the first point is the problem, then try to save to created picture in an array (or something else, in Basic I do this by using an array

Marwin
I found the way. I have to use Buffered Image (something like Marwin suggested me..)
I hope itll work.. 
Code: Alles auswählen
BufferedImage image = new BufferedImage(width, height, imageType);
Graphics graph = image.createGraphics();
drawImage(graph);
...
//in paint method:
public void paint(Graphics g) {
g.drawImage(image, 0, 0, null);
}

If the ship don't know where to go - it has no fair wind...