简体   繁体   中英

How to personalize TextField design with Swing

Is there a way to let the textField of eclipse/swing this way?

在此输入图像描述

You can add a matt look to the border of text field like this :

    JTextField textField = new JTextField();
// left side border        
    textField .setBorder(BorderFactory.createMatteBorder(0, 5, 0, 0, Color.BLACK));
//right side border
    textField.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 5, Color.BLACK));

If you need to customize only Inputfield, extends JTextInputField and Override the paint() method.

But probably you will need a full Look and Feel.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM