-
Notifications
You must be signed in to change notification settings - Fork 0
/
ImageGenerator.java
48 lines (28 loc) · 1.32 KB
/
ImageGenerator.java
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
41
42
43
44
45
46
47
48
package edu.bsu.cs222;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import javafx.scene.Group;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
public class ImageGenerator {
public Group GetImageAsGroup(String buttonName) throws FileNotFoundException {
InputStream fileLocationStream = new FileInputStream("src/main/Images/Rooms/Test" + buttonName + "Room.png");
Image roomImage = new Image(fileLocationStream);
ImageView viewableRoomImage = new ImageView();
viewableRoomImage.setImage(roomImage);
viewableRoomImage.setX(10);
viewableRoomImage.setY(10);
viewableRoomImage.setFitWidth(575);
viewableRoomImage.setPreserveRatio(true);
return new Group(viewableRoomImage);
}
public Group GetFurnitureImageAsGroup(String buttonName) throws FileNotFoundException {
InputStream fileLocationStream = new FileInputStream("src/main/Images/Furniture/" + buttonName);
Image roomImage = new Image(fileLocationStream);
ImageView viewableRoomImage = new ImageView();
viewableRoomImage.setImage(roomImage);
viewableRoomImage.setPreserveRatio(true);
return new Group(viewableRoomImage);
}
}