APL/DEV 3.1/TP2/Confirmation/Confirmation.java
2022-09-14 11:09:51 +02:00

39 lines
1.1 KiB
Java

import javax.swing.*;
import java.awt.*;
public class Confirmation {
private static String[] paths = {
"house", "info", "ok", "mail", "whatsapp"
};
private static CardLayout cards;
private static Container contentPane;
public static void next() {
cards.next(contentPane);
}
public static void previous() {
cards.previous(contentPane);
}
public static void main(String[] args) {
JFrame window = new JFrame("GalerieAlt");
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setSize(700, 700);
window.setLocation(200, 200);
window.addWindowListener(new ConfirmationListener());
window.setVisible(true);
contentPane = window.getContentPane();
cards = new CardLayout();
contentPane.setLayout(cards);
for (String path : paths) {
JLabel label = new JLabel(new ImageIcon("./images/" + path + ".png"));
label.addMouseListener(new ConfirmationListener());
contentPane.add(label, path);
}
}
}