本文整理汇总了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);
}
示例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;
}