javax.swing.text.JTextComponent.getToolTipText()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中javax.swing.text.JTextComponent.getToolTipText()方法的一些代码示例,展示了JTextComponent.getToolTipText()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextComponent.getToolTipText()方法的具体详情如下:
包路径:javax.swing.text.JTextComponent
类名称:JTextComponent
方法名:getToolTipText

JTextComponent.getToolTipText介绍

暂无

代码示例

代码示例来源:origin: AliView/AliView

private void showErrorMessage(JTextComponent aTextComponent) {
    StringBuilder message = new StringBuilder(ERROR_MESSAGE_START);
    message.append("\"");
    message.append(aTextComponent.getText());
    message.append("\"");
    if ( fUseToolTip ) {
      message.append(aTextComponent.getToolTipText());
    }
    aTextComponent.setText(message.toString());
  }
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

protected void initComponentDefaults() {
  this.errorColor = ValidatorDialog.WARNING_COLOR;
  this.defaultBGColor = textComponent.getBackground();
  this.defaultToolTip = textComponent.getToolTipText();
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

protected String buildText(JTextComponent target) {
  ToolTipSupport tts = ExtUtilities.getExtEditorUI(target).getToolTipSupport();
  return  (tts != null)
    ? target.getToolTipText(tts.getLastMouseEvent())
    : target.getToolTipText();
}

代码示例来源:origin: net.java.abeille/abeille

protected String buildText(JTextComponent target) {
  ToolTipSupport tts = ExtUtilities.getExtEditorUI(target).getToolTipSupport();
  return (tts != null) ? target.getToolTipText(tts.getLastMouseEvent()) : target.getToolTipText();
}

代码示例来源: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.apache.cayenne.modeler/cayenne-modeler

this.defaultToolTip = textComponent.getToolTipText();
this.textComponent = textComponent;

代码示例来源: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: 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

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.eas.platypus/platypus-js-scalable-widget

tc.putClientProperty(TEXT_COMPS_EDITABLE, tc.isEditable());
tc.putClientProperty(TEXT_COMPS_BACKGROUND, tc.getBackground());
tc.putClientProperty(TEXT_COMPS_HINT, tc.getToolTipText());
tc.setEditable(false);
tc.setBackground(Color.lightGray);

相关文章

JTextComponent类方法