Set JTextField Border - Java Swing

Java examples for Swing:JTextField

Description

Set JTextField Border

Demo Code

 
import java.awt.Color;
import java.awt.FlowLayout;
 
import javax.swing.BorderFactory;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.border.Border;
 
public class Main {
       /* www.  j  a  va 2s .  com*/
        public void init(){
                JTextField field = new JTextField("JTextField Border Example",20);
                Border border = BorderFactory.createLineBorder(Color.red);
                field.setBorder(border);
        }
}

Related Tutorials