JFrame frame = new JFrame("Shape Selector");
frame.setSize(800, 500);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton button = new JButton("Click me");
button.setSize(100, 50);
button.addActionListener(e -> {
System.out.println(Main.class.getClassLoader().getResource(""));
URL resourceUrl = Main.class.getClassLoader().getResource("/images/image.png");
String filePath = resourceUrl.getPath();
File file = new File(filePath);
Image image = null;
try {
image = ImageIO.read(file);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
addResizedImageToGUI(frame, image);
});
frame.getContentPane().add(button);
frame.setLayout(new FlowLayout());
frame.setVisible(true);
}```