javax.swing.JTextPane.setToolTipText()方法的使用及代码示例

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

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

JTextPane.setToolTipText介绍

暂无

代码示例

代码示例来源:origin: apache/pdfbox

@Override
public void mouseMoved(MouseEvent mouseEvent)
{
  if (tTController != null)
  {
    int offset = textPane.viewToModel(mouseEvent.getPoint());
    textPane.setToolTipText(tTController.getToolTip(offset, textPane));
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

private void prepareMessage(final String msg, final ImageIcon icon, final Color fgColor) {
  if( !SwingUtilities.isEventDispatchThread() ) {
    SwingUtilities.invokeLater( new Runnable() {
      @Override
      public void run() {
        prepareMessage( msg, icon, fgColor );
      }
    } );
    return;
  }
  String message = msg;
  messagePane.setToolTipText (message);
  if (message != null) {
    message = message.replaceAll("\\s", " "); // NOI18N
    if (! message.toUpperCase().startsWith("<HTML>")) { // NOI18N
      message = "<HTML>" + message; // NOI18N
    }
  }
  iconLabel.setIcon(icon);
  iconLabel.setForeground(fgColor);
  messagePane.setForeground(fgColor);
  messagePane.setText(message);
  messagePane.setFocusable(message != null);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mercurial

public void mouseMoved(MouseEvent e) {
  if (e.getSource().equals(textPane)) {
    textPane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    linkerSupport.computeBounds(textPane, 0);
    linkerSupport.mouseMoved(e.getPoint(), textPane, messageOffset);
  }
  textPane.setToolTipText("");  // NOI18N
}

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

private void clearError() {
  parent.setToolTipText(null);
  setStateBorder(defaultBorder);
  ToolTipManager.sharedInstance().setInitialDelay(DEFAULT_TOOL_TIP_INITIAL_DELAY);
  ToolTipManager.sharedInstance().setDismissDelay(DEFAULT_TOOL_TIP_DISMISS_DELAY);
}

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

private void setError(Exception e) {
  if (e != null) {
    ToolTipManager.sharedInstance().setInitialDelay(ERROR_TOOL_TIP_INITIAL_DELAY);
    ToolTipManager.sharedInstance().setDismissDelay(ERROR_TOOL_TIP_DISMISS_DELAY);
    if (e instanceof IllegalArgumentException) {
      parent.setToolTipText("Syntax error");
    }
    else {
      Throwable cause = e.getCause();
      String errorstring;
      if(cause!=null) {
        errorstring = cause.getMessage();
      }
      else {
        errorstring = e.getMessage();
      }
      if(errorstring != null) {
        parent.setToolTipText(getHTMLErrorMessage(errorstring));
      }
      else{
        parent.setToolTipText("Syntax error, check log");
      }
    }
    setStateBorder(errorBorder);
  } else {
    clearError();
  }
}

代码示例来源:origin: nroduit/Weasis

public static HyperlinkListener buildHyperlinkListener() {
  return e -> {
    JTextPane pane = (JTextPane) e.getSource();
    if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) {
      pane.setToolTipText(e.getDescription());
    } else if (e.getEventType() == HyperlinkEvent.EventType.EXITED) {
      pane.setToolTipText(null);
    } else if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
      Component parent = e.getSource() instanceof Component ? (Component) e.getSource() : null;
      openInDefaultBrowser(parent, e.getURL());
    }
  };
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-core

@Override
  public void hyperlinkUpdate(HyperlinkEvent e) {
    if(HyperlinkEvent.EventType.ENTERED == e.getEventType()) {
      if (CHECK_FOR_UPDATES_ACTION.equals(e.getDescription())) {
        description.setToolTipText(check_for_updates());
      } else if (e.getURL() != null) {
        description.setToolTipText(e.getURL().toExternalForm());
      }
    } else if (HyperlinkEvent.EventType.EXITED == e.getEventType()) {
      description.setToolTipText(null);
    } else if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
      if (CHECK_FOR_UPDATES_ACTION.equals(e.getDescription())) {
        checkForUpdates();
      } else {
        URLDisplayer.getDefault().showURL(e.getURL());
      }
    }
  }
});

代码示例来源:origin: dschanoeh/Kayak

/** This method is called from within the constructor to
 * initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
      jScrollPane2 = new javax.swing.JScrollPane();
      jTextPane1 = new javax.swing.JTextPane();
      jCheckBox1 = new javax.swing.JCheckBox();
      setLayout(new java.awt.BorderLayout(20, 20));
      jScrollPane2.setBorder(null);
      jTextPane1.setBorder(null);
      jTextPane1.setContentType(org.openide.util.NbBundle.getMessage(StartPageTopComponent.class, "StartPageTopComponent.jTextPane1.contentType")); // NOI18N
      jTextPane1.setEditable(false);
      jTextPane1.setFont(jTextPane1.getFont());
      jTextPane1.setText(org.openide.util.NbBundle.getMessage(StartPageTopComponent.class, "StartPageTopComponent.jTextPane1.text")); // NOI18N
      jTextPane1.setToolTipText(org.openide.util.NbBundle.getMessage(StartPageTopComponent.class, "StartPageTopComponent.jTextPane1.toolTipText")); // NOI18N
      jScrollPane2.setViewportView(jTextPane1);
      add(jScrollPane2, java.awt.BorderLayout.CENTER);
      org.openide.awt.Mnemonics.setLocalizedText(jCheckBox1, org.openide.util.NbBundle.getMessage(StartPageTopComponent.class, "StartPageTopComponent.jCheckBox1.text")); // NOI18N
      jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
              jCheckBox1ActionPerformed(evt);
          }
      });
      add(jCheckBox1, java.awt.BorderLayout.PAGE_END);
  }// </editor-fold>//GEN-END:initComponents

代码示例来源:origin: otros-systems/otroslogviewer

textPane.setToolTipText("");
    textPane.setToolTipText(toolTipText.toString());
 textPane.setToolTipText("Open in browser: " + STACKOVERFLOW_QUERY + msg);
 textPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
});

代码示例来源:origin: nroduit/Weasis

public SRView(Series<?> series) {
  JPanel panel = new JPanel();
  panel.setLayout(new BorderLayout());
  panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  htmlPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
  htmlPanel.setEditorKit(JMVUtils.buildHTMLEditorKit(htmlPanel));
  htmlPanel.setContentType("text/html"); //$NON-NLS-1$
  htmlPanel.setEditable(false);
  htmlPanel.addHyperlinkListener(e -> {
    JTextPane pane = (JTextPane) e.getSource();
    if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) {
      pane.setToolTipText(e.getDescription());
    } else if (e.getEventType() == HyperlinkEvent.EventType.EXITED) {
      pane.setToolTipText(null);
    } else if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
      String desc = e.getDescription();
      URL url = e.getURL();
      if (url == null && desc != null && desc.startsWith("#")) { //$NON-NLS-1$
        htmlPanel.scrollToReference(desc.substring(1));
      } else {
        openRelatedSeries(e.getURL().getHost());
      }
    }
  });
  setPreferredSize(new Dimension(1024, 1024));
  setSeries(series);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-kenai-ui

srcFeedPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
if (e.getDescription().startsWith("http://") || e.getDescription().startsWith("https://")) { //NOI18N
  srcFeedPane.setToolTipText(e.getDescription());
srcFeedPane.setToolTipText(""); //NOI18N
return;

代码示例来源:origin: java-deobfuscator/deobfuscator-gui

JTextPane textPane = new JTextPane();
textPane.setEditable(false);
textPane.setToolTipText(
  "Tip: If you copy this and paste it in the \"Load Config\" box, it will automatically input your configuration.");
scrollPane.setViewportView(textPane);

代码示例来源:origin: org.codehaus.castor/castor-jdo

_oqlquery.setToolTipText("create Query here");
_queryPanel.setLayout(_borderLayout2);
_resultScrollpane.setToolTipText("");

代码示例来源:origin: protegeproject/protege

@Override
  public void mouseMoved(MouseEvent e) {
    int pos = previewText.viewToModel(e.getPoint());
    StyledDocument doc = previewText.getStyledDocument();
    Element element = doc.getCharacterElement(pos);
    AttributeSet addtributes = element.getAttributes();
    Style style = doc.getStyle((String) addtributes
        .getAttribute(StyleConstants.NameAttribute));
    previewText.setToolTipText(
        "Click to change the " + style.getName() + " color");
  }
});

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

editor.setToolTipText(href);
  if (editor.getCursor().getType() != Cursor.HAND_CURSOR) {
    editor.setCursor(new Cursor(Cursor.HAND_CURSOR));
  editor.setToolTipText(null);
  if (editor.getCursor().getType() != Cursor.DEFAULT_CURSOR) {
    editor.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
editor.setToolTipText(null);

代码示例来源:origin: realXuJiang/bigtable-sql

editor.setToolTipText(href);
  if (editor.getCursor().getType() != Cursor.HAND_CURSOR) {
    editor.setCursor(new Cursor(Cursor.HAND_CURSOR));
  editor.setToolTipText(null);
  if (editor.getCursor().getType() != Cursor.DEFAULT_CURSOR) {
    editor.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
editor.setToolTipText(null);

代码示例来源:origin: org.vesalainen.dsql/dsql

@Override
public void report(String message, ErrorReporter.Level level, String source, int start, int end)
{
  switch (level)
  {
    case Fatal:
      color(redAction, start, end);
      break;
    case Hint:
      color(orangeAction, start, end);
      break;
    default:
      assert false;
  }
  sqlPane.setToolTipText(message);
  if (level.ordinal() > errorLevel.ordinal())
  {
    errorLevel = level;
  }
}

代码示例来源:origin: org.onebusaway/onebusaway-quickstart-mains

txtpnIfYouHave.setBackground(UIManager.getColor("control"));
txtpnIfYouHave.setText("If you have access to real-time transit information in the GTFS-realtime format for your agency, specify the source URLs here.");
txtpnIfYouHave.setToolTipText("");
add(txtpnIfYouHave, "cell 0 0,grow");

代码示例来源:origin: OneBusAway/onebusaway-application-modules

txtpnIfYouHave.setBackground(UIManager.getColor("control"));
txtpnIfYouHave.setText("If you have access to real-time transit information in the GTFS-realtime format for your agency, specify the source URLs here.");
txtpnIfYouHave.setToolTipText("");
add(txtpnIfYouHave, "cell 0 0,grow");

代码示例来源:origin: org.vesalainen.dsql/dsql

sqlPane.setToolTipText("");
color(blackAction, 0, sqlPane.getDocument().getLength());
String sql = sqlPane.getText();
    sqlPane.setToolTipText(ex.getLocalizedMessage());
    color(redAction, ex.getStart(), ex.getEnd());

相关文章

JTextPane类方法