Java Code Examples for javax.swing.plaf.basic.BasicTextFieldUI

The following examples show how to use javax.swing.plaf.basic.BasicTextFieldUI. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: gcs   Source File:    License: Mozilla Public License 2.0 5 votes vote down vote up
 * Creates a new text input field.
 * @param sheet        The sheet to listen to.
 * @param consumedType The field to listen to.
 * @param alignment    The alignment of the field.
 * @param editable     Whether or not the user can edit this field.
 * @param tooltip      The tooltip to set.
public PageField(CharacterSheet sheet, String consumedType, int alignment, boolean editable, String tooltip) {
    super(getFormatterFactoryForType(sheet.getCharacter(), consumedType), sheet.getCharacter().getValueForID(consumedType));
    if (Platform.isLinux()) {
        // I override the UI here since the GTK UI on Linux has no way to turn off the border
        // around text fields.
        setUI(new BasicTextFieldUI());
    mSheet = sheet;
    mConsumedType = consumedType;
    // Just setting opaque to false isn't enough for some reason, so I'm also setting the
    // background color to a 100% transparent value.
    setBackground(new Color(255, 255, 255, 0));
    if (editable) {
        setForeground(new Color(0, 0, 192));
    } else {
    mSheet.getCharacter().addTarget(this, mConsumedType);
    addPropertyChangeListener("value", this);