Java Utililty Methods JTextField Create

List of utility methods to do JTextField Create

Description

The list of methods to do JTextField Create are organized into topic(s).

Method

JTextFieldcreateJTextField(Container c, String text, int x, int y, int width)
This method makes it easy (and also neat) creating a JTextField and adding it to its container class.
JTextField txt = new JTextField(text);
txt.setBounds(x, y, width, 20);
c.add(txt);
return txt;
JTextFieldcreateJTextField(Rectangle bounds)
Creates a new JTextField object with the given properties.
JTextField txtField = new JTextField();
txtField.setFont(new Font("Times New Roman", Font.PLAIN, 12));
txtField.setBounds(bounds);
return txtField;
JTextFieldcreateJTextField(String name, int value, FocusListener fl)
Creates a new JTextField with the given name, integer value and adds a FocusListener.
JTextField jt = _createJTextField(name, fl);
jt.setText(Integer.toString(value));
return jt;
voidinitJTextField(JTextField text, String element)
Initiates the Text Field
text.setText(element);
voidinitLabelComponent(final JLabel label, final JTextField textField)
Initializes label with text field.
label.setLabelFor(textField);
label.setFocusable(false);
JTextFieldmakeJTextField(Document d, String s, int len, Object listener)
Factory Method to create TextFiled using specified params
JTextField pf = new JTextField(DEFAULT_TEXTFIELD_WIDTH) {
    public void setEnabled(boolean enabled) {
        super.setEnabled(enabled);
        super.setBackground(enabled ? Color.white : SystemColor.window);
};
pf.setEnabled(true);
if (d != null)
...