File: TileFetcher.java

package info (click to toggle)
gpsprune 26.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,824 kB
  • sloc: java: 52,154; sh: 25; makefile: 21; python: 15
file content (40 lines) | stat: -rw-r--r-- 658 bytes parent folder | download | duplicates (2)
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
31
32
33
34
35
36
37
38
39
40
package tim.prune.save;

import java.awt.Image;
import javax.swing.ImageIcon;


public class TileFetcher
{
	private final Grouter _parent;
	private final Image _image;
	private final int _x;
	private final int _y;
	private boolean _done = false;


	/** Constructor */
	TileFetcher(Grouter inParent, Image inImage, int inX, int inY)
	{
		_parent = inParent;
		_image = inImage;
		_x = inX;
		_y = inY;
	}

	void go() {
		new Thread(this::loadImage).start();
	}

	private void loadImage()
	{
		new ImageIcon(_image);
		_parent.tileReady(_image, _x, _y);
		_done = true;
	}

	/** @return true if this fetcher is done */
	boolean isDone() {
		return _done;
	}
}