【发布时间】:2012-06-07 23:27:11
【问题描述】:
我想定位我放置在 JLabel 中的图像。这是我的代码:
public Main() {
setLayout (new FlowLayout());
image = new ImageIcon(getClass().getResource("title.gif"));
image1 = new JLabel(image);
image1.setAlignmentX(400);
image1.setAlignmentY(400);
add(image1);
}
它显示图像,但线条
image1.setAlignmentX(400);
image1.setAlignmentY(400);
什么都不做。 我是 Java 新手,感谢任何帮助。
(我会欣赏一个例子。)
【问题讨论】:
-
对齐值应该是between
0and1。
标签: java swing layout jlabel flowlayout