我无法显示此 JLabel,其中包含特定坐标 (40,80) 处的图像。谁能告诉我我在这里做错了什么?
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.*;
public class Window extends JFrame{
//the pictures
JLabel guy = new JLabel(new ImageIcon("tester.gif"));
JPanel panel = new JPanel();
Window(){
super("WindowTitleThing");
setSize(700,600);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
guy.setAlignmentX(40);
guy.setAlignmentY(80);
add(panel);
panel.add(guy);
setVisible(true);
}
}