本文整理了Java中javax.swing.text.JTextComponent.setToolTipText()
方法的一些代码示例,展示了JTextComponent.setToolTipText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextComponent.setToolTipText()
方法的具体详情如下:
包路径:javax.swing.text.JTextComponent
类名称:JTextComponent
方法名:setToolTipText
暂无
代码示例来源:origin: geotools/geotools
public boolean validate() {
String txt = text.getText();
if (txt.length() == 0) {
return true;
}
Object value = Converters.convert(txt, parameter.type);
if (value == null) {
text.setToolTipText("Could not create " + parameter.type);
text.setForeground(Color.RED);
return false;
} else {
text.setToolTipText(null);
text.setForeground(Color.BLACK);
return true;
}
}
}
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
protected void clear() {
textComponent.setBackground(defaultBGColor);
textComponent.setToolTipText(defaultToolTip);
}
}
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
protected void clear() {
textComponent.setBackground(defaultBGColor);
textComponent.setToolTipText(defaultToolTip);
}
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
private void setTextFieldValue(String value, String projectValue, JTextComponent field) {
if (value != null) {
field.setText(value);
component.setToolTipText(""); //NOI18N
inherited = false;
label.setFont(label.getFont().deriveFont(Font.BOLD));
} else if (projectValue != null) {
field.setText(projectValue);
field.setSelectionEnd(projectValue.length());
field.setSelectionStart(0);
// field.setBackground(INHERITED);
label.setFont(label.getFont().deriveFont(Font.PLAIN));
component.setToolTipText(NbBundle.getMessage(TextComponentUpdater.class, "MSG_Value_Inherited"));
inherited = true;
} else {
field.setText("");//NOI18N
component.setToolTipText("");//NOI18N
inherited = false;
label.setFont(label.getFont().deriveFont(Font.BOLD));
}
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
private void setModelValue() {
if (inherited) {
inherited = false;
// component.setBackground(DEFAULT);
label.setFont(label.getFont().deriveFont(Font.BOLD));
component.setToolTipText(""); //NOI18N
}
setValue(component.getText().trim().length() == 0 ? null : component.getText());
if (component.getText().trim().length() == 0) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
component.getDocument().removeDocumentListener(TextComponentUpdater.this);
setTextFieldValue(getValue(), getDefaultValue(), component);
component.getDocument().addDocumentListener(TextComponentUpdater.this);
}
});
}
}
代码示例来源:origin: org.geotools/gt-swing
public boolean validate() {
String txt = text.getText();
if (txt.length() == 0) {
return true;
}
Object value = Converters.convert(txt, parameter.type);
if (value == null) {
text.setToolTipText( "Could not create "+parameter.type );
text.setForeground(Color.RED);
return false;
} else {
text.setToolTipText(null);
text.setForeground(Color.BLACK);
return true;
}
}
代码示例来源:origin: net.sf.cuf/cuf-swing
/**
* Decorates the text and tooltip of a text widget
* by an I18n key.
*
* @param pTextComponent text widget
* @param pI18nID I18n key
* @param pParams null or parameters
*/
private void initialize(final JTextComponent pTextComponent, final String pI18nID, final Object[] pParams)
{
// Text
String text= getText(pI18nID, pParams);
if ( text != null && !text.equals(pI18nID) )
{
pTextComponent.setText(text);
}
// Tooltip
String toolTipText = getToolTip(pI18nID, pParams);
if ( toolTipText != null && !toolTipText.equals(pI18nID) )
{
pTextComponent.setToolTipText(toolTipText);
}
}
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
public void updateModel() {
try {
updateModel(textComponent.getText());
clear();
}
catch (ValidationException vex) {
textComponent.setBackground(errorColor);
textComponent.setToolTipText(vex.getUnlabeledMessage());
}
}
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
protected void updateModel() {
try {
setValue(textComponent.getText());
clear();
}
catch (ValidationException vex) {
textComponent.setBackground(errorColor);
textComponent.setToolTipText(vex.getUnlabeledMessage());
}
}
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
protected void validate() {
try {
validate(textComponent.getText());
clear();
} catch (ValidationException vex) {
textComponent.setBackground(errorColor);
textComponent.setToolTipText(wrapTooltip(vex.getUnlabeledMessage()));
}
}
代码示例来源:origin: com.eas.platypus/platypus-js-scalable-widget
protected void clearEditingTexts() {
Iterator<JTextComponent> lit = editingTexts.iterator();
if (lit != null) {
while (lit.hasNext()) {
JTextComponent ltc = lit.next();
ltc.putClientProperty(TEXT_COMPS_EDITABLE, ltc.isEditable());
ltc.putClientProperty(TEXT_COMPS_BACKGROUND, ltc.getBackground());
ltc.putClientProperty(TEXT_COMPS_HINT, ltc.getToolTipText());
ltc.setEditable(false);
ltc.setBackground(Color.lightGray);
ltc.setToolTipText(localizations.getString("Click2Edit"));
if (ltc.getCaret() != null) {
ltc.getCaret().setVisible(false);
}
}
}
editingTexts.clear();
}
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
/**
* <p>
* Sets the prompt text on <code>textComponent</code>. Also sets the
* tooltip text to the prompt text if <code>textComponent</code> has no
* tooltip text or the current tooltip text is the same as the current
* prompt text.
* </p>
* <p>
* Calls {@link #install(JTextComponent)} to ensure that the
* <code>textComponent</code>s UI is wrapped by the appropriate
* {@link PromptTextUI}.
* </p>
*
* @param promptText
* @param textComponent
*/
public static void setPrompt(String promptText, JTextComponent textComponent) {
TextUIWrapper.getDefaultWrapper().install(textComponent, true);
// display prompt as tooltip by default
if (textComponent.getToolTipText() == null || textComponent.getToolTipText().equals(getPrompt(textComponent))) {
textComponent.setToolTipText(promptText);
}
textComponent.putClientProperty(PROMPT, promptText);
textComponent.repaint();
}
代码示例来源:origin: org.swinglabs.swingx/swingx-all
/**
* <p>
* Sets the prompt text on <code>textComponent</code>. Also sets the
* tooltip text to the prompt text if <code>textComponent</code> has no
* tooltip text or the current tooltip text is the same as the current
* prompt text.
* </p>
* <p>
* Calls {@link #install(JTextComponent)} to ensure that the
* <code>textComponent</code>s UI is wrapped by the appropriate
* {@link PromptTextUI}.
* </p>
*
* @param promptText
* @param textComponent
*/
public static void setPrompt(String promptText, JTextComponent textComponent) {
TextUIWrapper.getDefaultWrapper().install(textComponent, true);
// display prompt as tooltip by default
if (textComponent.getToolTipText() == null || textComponent.getToolTipText().equals(getPrompt(textComponent))) {
textComponent.setToolTipText(promptText);
}
textComponent.putClientProperty(PROMPT, promptText);
textComponent.repaint();
}
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
/**
* <p>
* Sets the prompt text on <code>textComponent</code>. Also sets the
* tooltip text to the prompt text if <code>textComponent</code> has no
* tooltip text or the current tooltip text is the same as the current
* prompt text.
* </p>
* <p>
* Calls {@link #install(JTextComponent)} to ensure that the
* <code>textComponent</code>s UI is wrapped by the appropriate
* {@link PromptTextUI}.
* </p>
*
* @param promptText
* @param textComponent
*/
public static void setPrompt(String promptText, JTextComponent textComponent) {
TextUIWrapper.getDefaultWrapper().install(textComponent, true);
// display prompt as tooltip by default
if (textComponent.getToolTipText() == null || textComponent.getToolTipText().equals(getPrompt(textComponent))) {
textComponent.setToolTipText(promptText);
}
textComponent.putClientProperty(PROMPT, promptText);
textComponent.repaint();
}
代码示例来源:origin: com.eas.platypus/platypus-js-scalable-widget
tc.setToolTipText(null);
tc.setToolTipText((String) lPropHint);
代码示例来源:origin: org.swinglabs.swingx/swingx-core
/**
* <p>
* Sets the prompt text on <code>textComponent</code>. Also sets the
* tooltip text to the prompt text if <code>textComponent</code> has no
* tooltip text or the current tooltip text is the same as the current
* prompt text.
* </p>
* <p>
* Calls {@link #install(JTextComponent)} to ensure that the
* <code>textComponent</code>s UI is wrapped by the appropriate
* {@link PromptTextUI}.
* </p>
*
* @param promptText
* @param textComponent
*/
public static void setPrompt(String promptText, JTextComponent textComponent) {
TextUIWrapper.getDefaultWrapper().install(textComponent, true);
// display prompt as tooltip by default
if (textComponent.getToolTipText() == null || textComponent.getToolTipText().equals(getPrompt(textComponent))) {
textComponent.setToolTipText(promptText);
}
textComponent.putClientProperty(PROMPT, promptText);
textComponent.repaint();
}
代码示例来源:origin: bcdev/beam
String toolTiptext = getParameter().getProperties().getDescription();
_textComponent.setText(getParameter().getValueAsText());
_textComponent.setToolTipText(toolTiptext);
_textComponent.setInputVerifier(getDefaultInputVerifier());
代码示例来源:origin: org.netbeans.api/org-netbeans-spi-quicksearch
keyStroke) + ")"; //NOI18N
command.setToolTipText(org.openide.util.NbBundle.getMessage(AbstractQuickSearchComboBar.class, "AbstractQuickSearchComboBar.command.toolTipText", new Object[] {shortcutText})); // NOI18N
command.setName("command"); // NOI18N
command.addFocusListener(new java.awt.event.FocusAdapter() {
代码示例来源:origin: bcdev/beam
_textComponent.setToolTipText(getParamProps().getDescription());
代码示例来源:origin: com.eas.platypus/platypus-js-scalable-widget
tc.setEditable(false);
tc.setBackground(Color.lightGray);
tc.setToolTipText(localizations.getString("Click2Edit"));
内容来源于网络,如有侵权,请联系作者删除!