Java Swing rounded border for Jtextfield
问题 When I do : LineBorder lineBorder =new LineBorder(Color.white, 8, true); jTextField2.setBorder(lineBorder ); I get this result like: How can I have rounded borders without the squared corners visible and the text half cut ? Thank you very much. Best regards 回答1: You can override JTextFiled build your own Rounded corner JTextField . You have to override it's paintComponent() , paintBorder() , and contains() methods. You need to draw roundRect as the shape of text field. Example: public class