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


Java PromptSupport.getFontStyle方法代码示例

本文整理汇总了Java中org.jdesktop.swingx.prompt.PromptSupport.getFontStyle方法的典型用法代码示例。如果您正苦于以下问题:Java PromptSupport.getFontStyle方法的具体用法?Java PromptSupport.getFontStyle怎么用?Java PromptSupport.getFontStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jdesktop.swingx.prompt.PromptSupport的用法示例。


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

示例1: getPromptFontStyle

import org.jdesktop.swingx.prompt.PromptSupport; //导入方法依赖的package包/类
/**
 * @see PromptSupport#getFontStyle(javax.swing.text.JTextComponent)
 */
public Integer getPromptFontStyle() {
	return PromptSupport.getFontStyle(this);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:7,代码来源:JXFormattedTextField.java

示例2: getPromptComponent

import org.jdesktop.swingx.prompt.PromptSupport; //导入方法依赖的package包/类
/**
 * Creates a label component, if none has already been created. Sets the
 * prompt components properties to reflect the given {@link JTextComponent}s
 * properties and returns it.
 * 
 * @param txt
 * @return the adjusted prompt component
 */
public JTextComponent getPromptComponent(JTextComponent txt) {
    if (promptComponent == null) {
        promptComponent = createPromptComponent();
    }
    if (txt.isFocusOwner()
            && PromptSupport.getFocusBehavior(txt) == FocusBehavior.HIDE_PROMPT) {
        promptComponent.setText(null);
    } else {
        promptComponent.setText(PromptSupport.getPrompt(txt));
    }

    promptComponent.getHighlighter().removeAllHighlights();
    if (txt.isFocusOwner()
            && PromptSupport.getFocusBehavior(txt) == FocusBehavior.HIGHLIGHT_PROMPT) {
        promptComponent.setForeground(txt.getSelectedTextColor());
        try {
            promptComponent.getHighlighter().addHighlight(0,
                    promptComponent.getText().length(),
                    new DefaultHighlightPainter(txt.getSelectionColor()));
        } catch (BadLocationException e) {
            e.printStackTrace();
        }
    } else {
        promptComponent.setForeground(PromptSupport.getForeground(txt));
    }

    if (PromptSupport.getFontStyle(txt) == null) {
        promptComponent.setFont(txt.getFont());
    } else {
        promptComponent.setFont(txt.getFont().deriveFont(
                PromptSupport.getFontStyle(txt)));
    }

    promptComponent.setBackground(PromptSupport.getBackground(txt));
    promptComponent.setHighlighter(new PainterHighlighter(PromptSupport
            .getBackgroundPainter(txt)));
    promptComponent.setEnabled(txt.isEnabled());
    promptComponent.setOpaque(txt.isOpaque());
    promptComponent.setBounds(txt.getBounds());
    Border b = txt.getBorder();
    
    if (b == null) {
        promptComponent.setBorder(txt.getBorder());
    } else {
        Insets insets = b.getBorderInsets(txt);
        promptComponent.setBorder(
                createEmptyBorder(insets.top, insets.left, insets.bottom, insets.right));
    }
    
    promptComponent.setSelectedTextColor(txt.getSelectedTextColor());
    promptComponent.setSelectionColor(txt.getSelectionColor());
    promptComponent.setEditable(txt.isEditable());
    promptComponent.setMargin(txt.getMargin());

    return promptComponent;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:65,代码来源:PromptTextUI.java


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