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

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

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

JTextPane.insertIcon介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

doc.insertString(doc.getLength(), "Test", normal);
jtp.setSelectionStart(doc.getLength());
jtp.insertIcon(UIManager.getIcon("OptionPane.warningIcon"));
jtp.setSelectionStart(doc.getLength());
jtp.insertComponent(new JLabel("Label"));

代码示例来源:origin: stackoverflow.com

JTextPane pane = new JTextPane ();
pane.insertIcon ( new ImageIcon ( "/path/to/image.png" ) );

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

public void run() {
    text.insertIcon(icon);
    resetCommandStart();
    text.setCaretPosition(cmdStart);
  }
});

代码示例来源:origin: stackoverflow.com

actionTextPane.insertIcon(new ImageIcon("fifight.gif"));
  break;
case "<CLERIC>":
  actionTextPane.insertIcon(new ImageIcon("mage.gif"));
  break;
case "<GOLD>":
  actionTextPane.insertIcon(new ImageIcon("Gold.png"));
  break;

代码示例来源:origin: triplea-game/triplea

try {
 text.insertIcon(lastIcon);
 doc.insertString(doc.getLength(), prefix, bold);
 doc.insertString(doc.getLength(), m.group(1) + "\n", normal);

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

if (fancy) {
  textpane.setEditable(true);
  textpane.insertIcon(icons.get(event.getLevel()));
  textpane.setEditable(false);

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

private void updatePatterns() {
 final String text = loggerConfigTextPane.getText();
 final List<LogPattern> resultList = getLogPatterns(text);
 try {
  styledDocument.remove(0, styledDocument.getLength());
  for (LogPattern result : resultList) {
   resultTextPane.insertIcon(result.isValid() ? Icons.STATUS_OK : Icons.STATUS_ERROR);
   styledDocument.insertString(styledDocument.getLength(), " " + result.getPattern() + "\n", defaultStyle);
  }
 } catch (BadLocationException ignore) {
 }
 if (resultList.isEmpty()) {
  resultTextPane.setText("No logger patterns detected in project opened in IDE.");
 }
}

代码示例来源:origin: triplea-game/triplea

text.insertIcon(icon);
doc.insertString(doc.getLength(), prefix, bold);
doc.insertString(doc.getLength(), m.group(1) + "\n", normal);

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

protected void updateChanges(List<TextChunkWithStyle> chunks) {
 LOGGER.trace("Start updating view with chunks, size: " + chunks.size());
 StyledDocument document = otrosJTextWithRulerScrollPane.getjTextComponent().getStyledDocument();
 int i = 0;
 for (TextChunkWithStyle chunk : chunks) {
  LOGGER.trace("Updating with chunk " + i++);
  try {
   if (chunk.getString() != null) {
    if (chunk.getMessageFragmentStyle() != null) {
     document.insertString(document.getLength(), chunk.getString(), chunk.getMessageFragmentStyle().getStyle());
    } else {
     document.insertString(document.getLength(), chunk.getString(), chunk.getStyle());
    }
   } else if (chunk.getMessageFragmentStyle() != null) {
    MessageFragmentStyle mfs = chunk.getMessageFragmentStyle();
    document.setCharacterAttributes(mfs.getOffset(), mfs.getLength(), mfs.getStyle(), mfs.isReplace());
   }
   if (chunk.getIcon() != null) {
    otrosJTextWithRulerScrollPane.getjTextComponent().insertIcon(chunk.getIcon());
   }
  } catch (BadLocationException e) {
   LOGGER.error("Can't update log details text area", e);
  }
 }
 otrosJTextWithRulerScrollPane.getjTextComponent().setCaretPosition(0);
 MessageUpdateUtils.highlightSearchResult(otrosJTextWithRulerScrollPane, colorizersContainer, otrosApplication.getTheme());
 RulerBarHelper.scrollToFirstMarker(otrosJTextWithRulerScrollPane);
}

代码示例来源:origin: stackoverflow.com

((HTMLEditorKit) this.getEditorKit()).read(new java.io.StringReader("<img src=\"" + file + "\" />"), this.getDocument(), this.getSelectionStart());
  ImageIcon imgicon = new ImageIcon(file);
  this.insertIcon(imgicon);
} catch (Exception ex) {
  ex.printStackTrace();

相关文章

JTextPane类方法