How to locate JLabels to an absolute position on Java GUI

[亡魂溺海] 提交于 2019-11-27 09:29:28

See Doing Without a Layout Manager (Absolute Positioning) in the Java tutorials.

Creating a container without a layout manager involves the following steps.

  1. Set the container's layout manager to null by calling setLayout(null).
  2. Call the Component class's setbounds method for each of the container's children.
  3. Call the Component class's repaint method.

Either

Jon

Take a look at MigLayout, which allows you to do absolute positioning, it's not part of the JDK, but a seperate download.

It's very good as far as layout managers go and does absolute positioning, plus a whole load of other things.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!