Here you can find the source of enableJTextField(JTextComponent component, boolean enable, Color color)
public static void enableJTextField(JTextComponent component, boolean enable, Color color)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.awt.Color; import javax.swing.text.JTextComponent; public class Main { public static void enableJTextField(JTextComponent component, boolean enable, Color color) { component.setEnabled(enable);/* w ww . j av a2s . c om*/ component.setEditable(enable); component.setBackground(color); component.invalidate(); component.validate(); component.repaint(1); } }