Java examples for Swing:JTextField
How to set foreground color of JTextField's text
import java.awt.Color; import java.awt.FlowLayout; import javax.swing.JApplet; import javax.swing.JTextField; public class Main { // w w w.ja va 2 s .com public void init(){ JTextField field = new JTextField("JTextField Foreground Color Example",20); Color color = Color.RED; field.setForeground(color); } }