Here you can find the source of createJTextField(String name, int value, FocusListener fl)
Parameter | Description |
---|---|
name | JTextField name. |
value | JTextField value. |
fl | FocusListener for this object's events |
public static JTextField createJTextField(String name, int value, FocusListener fl)
//package com.java2s; //License from project: Open Source License import java.awt.event.FocusListener; import javax.swing.JTextField; public class Main { /**//from ww w . j ava 2 s. co m * Creates a new JTextField with the given name, integer value and adds * a FocusListener. * @param name JTextField name. * @param value JTextField value. * @param fl FocusListener for this object's events * @return The newly formed JTextField. */ public static JTextField createJTextField(String name, int value, FocusListener fl) { JTextField jt = _createJTextField(name, fl); jt.setText(Integer.toString(value)); return jt; } /** * Creates a new JTextField with the given name, double value and adds * a FocusListener. * @param name JTextField name. * @param value JTextField value. * @param fl FocusListener for this object's events * @return The newly formed JTextField. */ public static JTextField createJTextField(String name, double value, FocusListener fl) { JTextField jt = _createJTextField(name, fl); jt.setText(Double.toString(value)); return jt; } private static JTextField _createJTextField(String name, FocusListener fl) { JTextField jt = new JTextField(); jt.setName(name); jt.addFocusListener(fl); return jt; } }