经过大量研究,我只能使用标签获取该图像。现在我无法改变它的位置。我尝试了很多功能。我需要什么确切的功能更改JLabel的位置
public class Board extends JFrame {
private ImageIcon image;
private JLabel label;
public Board() {
image = new ImageIcon(getClass().getResource("board.png"));
label = new JLabel(image);
label.setLocation(200, 0); //This is the one that I expected to do the thing
add(label);
}
public static void main(String [] args) {
Board b = new Board();
b.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
b.setVisible(true);
b.setSize(1280, 1000);
}
}
你想达到什么目的? – 2015-03-13 19:07:49
你对布局有什么想法吗? – emin 2015-03-13 19:08:14
我正在开发一个垄断应用程序,这个图像是我的董事会。董事会现在在中心。我希望它在框架的左上部分。 – Mehr 2015-03-13 19:17:21