當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。