How to locate JLabels to an absolute position on Java GUI

后端 未结 3 1768
醉话见心
醉话见心 2020-12-02 00:08

I have many JLabels (which includes ImageIcons) in a JPanel.

And this JPanel is only a panel on the GUI; there ar

3条回答
  •  难免孤独
    2020-12-02 01:10

    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.

提交回复
热议问题