/home/caleb/ASDV-Java/Semester 3/Assignments/lab2_FX2_F22_part1/src/lab2_fx2_f22_part1/ImageArray2.java |
nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
package lab2_fx2_f22_part1;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ImageArray2 extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
final String BASE_PATH = "image/flag";
ImageView[] images = new ImageView[] {
new ImageView(BASE_PATH+"0.gif"),
new ImageView(BASE_PATH+"1.gif"),
new ImageView(BASE_PATH+"2.gif"),
new ImageView(BASE_PATH+"3.gif"),
new ImageView(BASE_PATH+"4.gif"),
new ImageView(BASE_PATH+"5.gif"),
new ImageView(BASE_PATH+"6.gif")
};
Pane vb = new VBox(10);
vb.setPadding(new Insets(5, 5, 5, 5));
for (int i = 0; i < 7; ++i) {
images[i].setFitWidth(150);
images[i].setFitHeight(100);
vb.getChildren().add(images[i]);
}
Scene scene = new Scene(vb);
primaryStage.setTitle("Flags");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}