-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImages.java
More file actions
36 lines (32 loc) · 928 Bytes
/
Images.java
File metadata and controls
36 lines (32 loc) · 928 Bytes
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
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
*/
package com.zipper.mavenproject1;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import javax.imageio.ImageIO;
/**
*
* @author apple
*/
public class Images {
private BufferedImage image;
private String identifier;
private Path imagePath;
public Images(String identifier){
this.identifier = identifier;
this.imagePath = Paths.get("NetBeansProjects/mavenproject1/src/main/java/com/zipper/mavenproject1/" + identifier);
try {
this.image = ImageIO.read(new File(imagePath.toString()));
} catch (IOException e) {
System.out.println("Error reading image: " + e.getMessage());
}
}
public BufferedImage getImage(){
return image;
}
}