How to align JLabel-JTextField pairs vertically

前端 未结 7 1160
独厮守ぢ
独厮守ぢ 2020-12-11 02:33

What I mean by a JLabel-JTextField pair is a JLabel component followed by a JTextField one, for example, \"Parameter 1: -----\" where \"-----\" denotes a blank JTextField.

7条回答
  •  鱼传尺愫
    2020-12-11 03:29

    I would suggest the GridLayout layout manager. It presents the easiest solution to show pair-wise visualization of label and textbox controls. Thereby you simply define the number of rows and columns at time of instantiation and the added controls will be handled by the manager.

提交回复
热议问题