How can I control the width of JTextFields in Java Swing?

后端 未结 4 1269
醉酒成梦
醉酒成梦 2021-01-03 20:06

I am trying to have several JTextFields on a single row, but I don\'t want them to have the same width. How can I control the width and make some of them wider than others?

4条回答
  •  渐次进展
    2021-01-03 20:43

    yourTextField = new JTextField("", 20);
    

    if you start it like this it sets the textfield to be empty and to have 20 collumns

提交回复
热议问题