APL/DEV 3.1/TP2/Confirmation/Confirmation.java

39 lines
1.1 KiB
Java
Raw Normal View History

2022-09-14 11:01:07 +02:00
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 ConfirmationWListener());
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 ConfirmationMListener());
contentPane.add(label, path);
}
}
}