Home>

I'm currently trying to put a JButton inside a JFrame.
So please tell me how to display the JButton at the bottom right of the JFrame.
Ideally, it's better not to specify the coordinates of the JButton.
If there is no other way but to specify the coordinates of JButton, I would appreciate it if you could say so.

Postscript:
Also, how do I add a JButton next to the elements (JTextField and JTextArea)?

Supplementary information (FW/tool version, etc.)

java jdk-14.0.2

java version "14.0.2" 2020-07-14
Java (TM) SE Runtime Environment (build 14.0.2 + 12-46)
Java HotSpot (TM) 64-Bit Server VM (build 14.0.2 + 12-46, mixed mode, sharing)

  • Answer # 1

    I prepared a JPanel, installed it at the bottom of the JFrame, and then installed the JButton on the JPanel to the right.

Related articles