rewritten AbstractDrawer to use ImageStorage
This commit is contained in:
		@@ -1,25 +1,25 @@
 | 
			
		||||
package cicaprojekt;
 | 
			
		||||
 | 
			
		||||
import java.awt.image.BufferedImage;
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
 | 
			
		||||
import javax.imageio.ImageIO;
 | 
			
		||||
 | 
			
		||||
public abstract class AbstractDrawer implements Drawer {
 | 
			
		||||
    private BufferedImage image;
 | 
			
		||||
    private static ImageStorage storage;
 | 
			
		||||
    private String filename;
 | 
			
		||||
 | 
			
		||||
    public AbstractDrawer(String path) throws IOException {                
 | 
			
		||||
        image = ImageIO.read(new File(path));
 | 
			
		||||
 | 
			
		||||
    public AbstractDrawer(String path) throws IOException {
 | 
			
		||||
        storage = new ImageStorage();
 | 
			
		||||
        filename = path;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public void changeImage(String path) throws IOException {
 | 
			
		||||
        image = ImageIO.read(new File(path));
 | 
			
		||||
        filename = path;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public BufferedImage getImage() {
 | 
			
		||||
        return image;
 | 
			
		||||
        return storage.getImage(filename);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user