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"));
JTextPane pane = new JTextPane (); pane.insertIcon ( new ImageIcon ( "/path/to/image.png" ) );
public void run() { text.insertIcon(icon); resetCommandStart(); text.setCaretPosition(cmdStart); } });
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;
try { text.insertIcon(lastIcon); doc.insertString(doc.getLength(), prefix, bold); doc.insertString(doc.getLength(), m.group(1) + "\n", normal);
if (fancy) { textpane.setEditable(true); textpane.insertIcon(icons.get(event.getLevel())); textpane.setEditable(false);
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."); } }
text.insertIcon(icon); doc.insertString(doc.getLength(), prefix, bold); doc.insertString(doc.getLength(), m.group(1) + "\n", normal);
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); }
((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();