Java tutorial
//package com.java2s; import javax.swing.JComponent; import javax.swing.JTextField; public class Main { public static JTextField createTextField(int cols) { return createTextField("", cols); } public static JTextField createTextField(String text) { return createTextField(text, 0); } public static JTextField createTextField(String text, int cols) { final JTextField b = new JTextField(text, cols); configureActiveComponent(b); return b; } private static JComponent configureActiveComponent(JComponent c) { // if (benchRuns == 0) { // c.addMouseMotionListener(toolTipListener); // c.addMouseListener(constraintListener); // } return c; } }