Example usage for javax.swing JTextField getHeight

List of usage examples for javax.swing JTextField getHeight

Introduction

In this page you can find the example usage for javax.swing JTextField getHeight.

Prototype

@BeanProperty(bound = false)
public int getHeight() 

Source Link

Document

Returns the current height of this component.

Usage

From source file:openlr.mapviewer.coding.ui.AbstractCodingOptionsDialog.java

/**
 * Sets up an input field of the form//from  w  ww  . java  2 s  . com
 * 
 * @param propKey
 *            The full configuration property key this field relates to
 * @param value
 *            The initial value to set
 * @return The set-up input field
 */
private JTextField createInputField(final String propKey, final String value) {

    final JTextField valueField = new JTextField();
    valueField.setText(value);
    valueField.setHorizontalAlignment(JTextField.RIGHT);
    valueField.setPreferredSize(new Dimension(WIDT_INPUT_FIELD, valueField.getHeight()));
    optionsTextFields.put(propKey, valueField);

    final String defaultValue = defaultConfig.getString(propKey);
    valueField.getDocument().addDocumentListener(new VisualPropertyChangeListener(valueField, defaultValue));
    if (!defaultValue.equals(value)) {
        valueField.setBackground(VisualPropertyChangeListener.COLOR_FIELD_VALUE_DIFF_DEFAULT);
    }
    StringBuilder toolTip = new StringBuilder();
    toolTip.append(propKey).append(", default: ").append(defaultValue);

    valueField.setToolTipText(toolTip.toString());

    afterInputFieldCreation(propKey, valueField);

    return valueField;
}