Java Code Examples for org.eclipse.swt.widgets.Label.pack()

The following are Jave code examples for showing how to use pack() of the org.eclipse.swt.widgets.Label class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: eZooKeeper   File: GridTextInput.java   View Source Code Vote up 5 votes
/**
 * Constructor.
 *
 * @param parent The parent {@link Composite}.
 * @param type The {@link Type}.
 * @param name The {@link GridTextInput} name.
 * @param labelText The {@link Label} text.
 * @param labelStyle The {@link Label} style.
 * @param labelLayoutData The {@link Label} {@link GridData layout data}.
 * @param textText The {@link Text} text.
 * @param textStyle The {@link Text} style.
 * @param textLayoutData The {@link Text} {@link GridData layout data}.
 */
public GridTextInput(Composite parent, Type type, String name, String labelText, int labelStyle,
        GridData labelLayoutData, String textText, int textStyle, GridData textLayoutData) {

    _Type = type;

    _DefaultTextValue = textText;

    if (_DefaultTextValue != null && _Type.isInteger()) {
        if (!isValidIntegerText(_DefaultTextValue)) {
            throw new IllegalArgumentException("Invalid integer value: " + _DefaultTextValue);
        }
    }

    _Name = name;

    if (labelText != null) {
        _Label = new Label(parent, labelStyle);
        _Label.setText(labelText);
        _Label.setLayoutData(labelLayoutData);
        _Label.pack();
    }

    _Text = new Text(parent, textStyle);
    if (textText != null) {
        _Text.setText(textText);
    }
    _Text.setLayoutData(textLayoutData);

    if (_Type.isInteger()) {
        _Text.setTextLimit(10);
    }

    _Text.setData(this);

}