当前位置: 首页>>代码示例>>Java>>正文


Java BasicTextFieldUI类代码示例

本文整理汇总了Java中javax.swing.plaf.basic.BasicTextFieldUI的典型用法代码示例。如果您正苦于以下问题:Java BasicTextFieldUI类的具体用法?Java BasicTextFieldUI怎么用?Java BasicTextFieldUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BasicTextFieldUI类属于javax.swing.plaf.basic包,在下文中一共展示了BasicTextFieldUI类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: PageField

import javax.swing.plaf.basic.BasicTextFieldUI; //导入依赖的package包/类
/**
 * 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(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;
    setFont(sheet.getScale().scale(UIManager.getFont(GCSFonts.KEY_FIELD)));
    setBorder(null);
    setOpaque(false);
    // 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));
    setHorizontalAlignment(alignment);
    setEditable(editable);
    setEnabled(editable);
    setForeground(editable ? Color.BLACK : Color.GRAY);
    if (tooltip != null) {
        setToolTipText(Text.wrapPlainTextForToolTip(tooltip));
        if (tooltip.indexOf("{") != -1) { //$NON-NLS-1$
            mCustomToolTip = tooltip;
        }
    }
    mSheet.getCharacter().addTarget(this, mConsumedType);
    addPropertyChangeListener("value", this); //$NON-NLS-1$
    addActionListener(this);
    setFocusLostBehavior(COMMIT_OR_REVERT);

    // Reset the selection colors back to what is standard for text fields.
    // This is necessary, since (at least on the Mac) JFormattedTextField
    // has the wrong values by default.
    setCaretColor(UIManager.getColor("TextField.caretForeground")); //$NON-NLS-1$
    setSelectionColor(UIManager.getColor("TextField.selectionBackground")); //$NON-NLS-1$
    setSelectedTextColor(UIManager.getColor("TextField.selectionForeground")); //$NON-NLS-1$
    setDisabledTextColor(UIManager.getColor("TextField.inactiveForeground")); //$NON-NLS-1$
}
 
开发者ID:richardwilkes,项目名称:gcs,代码行数:48,代码来源:PageField.java

示例2: createTextField

import javax.swing.plaf.basic.BasicTextFieldUI; //导入依赖的package包/类
/**
 * Creates the text field allowing the user to enter filter text.
 *
 * @return The text field.
 */
private JTextField createTextField() {
	JTextField field = new JTextField(30);
	field.setUI(new BasicTextFieldUI());
	field.setBorder(new TextFieldBorder());
	field.addActionListener(listener);
	field.addKeyListener(listener);
	field.getDocument().addDocumentListener(listener);
	return field;
}
 
开发者ID:pyros2097,项目名称:GdxStudio,代码行数:15,代码来源:GoToMemberWindow.java

示例3: updateUI

import javax.swing.plaf.basic.BasicTextFieldUI; //导入依赖的package包/类
@Override
public void updateUI() {
    setUI(new BasicTextFieldUI());
    if (myColors != null) updateColors();
}
 
开发者ID:samebug,项目名称:samebug-idea-plugin,代码行数:6,代码来源:InputField.java

示例4: promptSupportMustStayInstalled

import javax.swing.plaf.basic.BasicTextFieldUI; //导入依赖的package包/类
private void promptSupportMustStayInstalled() {
	assertEquals(BuddyTextFieldUI.class, txt.getUI().getClass());
	txt.setUI(new BasicTextFieldUI());
	assertEquals(BuddyTextFieldUI.class, txt.getUI().getClass());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:6,代码来源:PromptSupportTest.java

示例5: mustBeInstalled

import javax.swing.plaf.basic.BasicTextFieldUI; //导入依赖的package包/类
private void mustBeInstalled() {
	assertEquals(BuddyTextFieldUI.class, txt.getUI().getClass());
	txt.setUI(new BasicTextFieldUI());
   	assertEquals(BasicTextFieldUI.class, txt.getUI().getClass());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:6,代码来源:TextUIWrapperTest.java

示例6: mustStayInstalled

import javax.swing.plaf.basic.BasicTextFieldUI; //导入依赖的package包/类
private void mustStayInstalled() {
	assertEquals(BuddyTextFieldUI.class, txt.getUI().getClass());
   	txt.setUI(new BasicTextFieldUI());
   	assertEquals(BuddyTextFieldUI.class, txt.getUI().getClass());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:6,代码来源:TextUIWrapperTest.java


注:本文中的javax.swing.plaf.basic.BasicTextFieldUI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。