How can I add padding to a jtextfield

后端 未结 6 1693
予麋鹿
予麋鹿 2021-01-01 12:08

How can I add some padding to a jtextfield? I\'ve tried tf.setMargin(new Insets(5,5,5,5)); which doesn\'t have any effect.

6条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-01 12:26

    yourTextFeildVariable.setBorder(BorderFactory.createCompoundBorder(yourTextFeildVariable.getBorder(), BorderFactory.createEmptyBorder(0, 5, 0, 0)));
    

    This is working 100%

提交回复
热议问题