All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ace.ui.components.partial.text.field.TextReadOnlyDataPanel Maven / Gradle / Ivy

The newest version!
package ace.ui.components.partial.text.field;

import javax.swing.*;
import java.awt.*;

/**
 * Displays a {@link Label} and a {@link JTextField} which disables editing the field
 * @param  type of stored data
 */
public class TextReadOnlyDataPanel extends ATextField {
    /**
     * @param name name to display on the {@link Label} in the super class
     * @param variableValue value to show in the {@link TextFormattedDataPanel#variableValueContainer}
     */
    public TextReadOnlyDataPanel(String name, T variableValue) {
        super(name);

        this.variableValueContainer = new JTextField();
        if (variableValue instanceof String) {
            this.variableValueContainer.setText((String) variableValue);
        } else {
            this.variableValueContainer.setText(String.valueOf(variableValue));
        }
        this.variableValueContainer.setEditable(false);

        add(this.variableValueContainer);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy