StyleConstants.setForeground(normal, Color.blue); 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")); jtp.setSelectionStart(doc.getLength());
); this.bruteForceManager.getResult().setSelectionStart(selectionStart); this.bruteForceManager.getResult().setSelectionEnd(selectionEnd);
protected void setStrategyDescriptionText(String aText) { if (strategyDescription != null) { String newText = aText.replaceAll("'", "'"); String htmlText = "<html><body face=\"arial\">" + newText + "</body></html>"; strategyDescription.setText(htmlText); strategyDescription.setSelectionStart(0); strategyDescription.setSelectionEnd(0); } }
public static JTextPane scrolledText(final int width, final int height, final String text, final DocumentListener listener, final Container addTo) { final JTextPane component = new JTextPane(); component.getDocument().addDocumentListener(listener); if (text != null) component.setText(text); component.setSelectionStart(0); component.setSelectionEnd(0); scrollPane(component, width, height, addTo); return component; }
protected void setEndSelection() { inbox.setSelectionStart(inbox.getDocument().getLength()); inbox.setSelectionEnd(inbox.getDocument().getLength()); }
public void actionPerformed(ActionEvent e) { String outText = "ISSUE:123";//NOI18N try { out.requestFocus(); int caretPosition = out.getCaretPosition(); out.getDocument().insertString( caretPosition, " " + outText + " ", null); // NOI18N out.setSelectionStart(caretPosition+7); out.setSelectionEnd(caretPosition+outText.length()+1); } catch (BadLocationException ex) { Exceptions.printStackTrace(ex); } } }
public void actionPerformed(ActionEvent e) { String outText = "FILE:foo/bar/Test.java:23"; // NOI18N try { out.requestFocus(); int caretPosition = out.getCaretPosition(); out.getDocument().insertString( caretPosition, " " + outText + " ", null); // NOI18N out.setSelectionStart(caretPosition+6); out.setSelectionEnd(caretPosition+outText.length()+1); } catch (BadLocationException ex) { Exceptions.printStackTrace(ex); } } }
private void autoExpandSelection() { int start = editorPane.getSelectionStart(); int end = editorPane.getSelectionEnd(); String txt = editorPane.getText(); while (start > 0 && !Character.isWhitespace(txt.charAt(start - 1)) && !StringUtils.isPunctuation( txt.charAt(start - 1))) { start--; } while (start < end && Character.isWhitespace(txt.charAt(start))) { start++; } while (end < txt.length() && !Character.isWhitespace(txt.charAt(end)) && !StringUtils.isPunctuation( txt.charAt(end))) { end++; } while (end > start && Character.isWhitespace(txt.charAt(end - 1))) { end--; } if (start == end) { return; } editorPane.setSelectionEnd(end); editorPane.setSelectionStart(start); }
int row = annotationTable.getRowSorter().convertRowIndexToModel(e.getLastIndex()); if (row >= 0) { editorPane.setSelectionStart(annotationTableModel.getStart(row)); editorPane.setSelectionEnd(annotationTableModel.getEnd(row));
textArea.setSelectionStart (iStartSel); textArea.setSelectionEnd (iEndSel);
annotationTextPane.setSelectionStart(0); annotationTextPane.setSelectionEnd(0);
private void syncEditorSelection(MouseEvent e) { if (e.isPopupTrigger()) { return; } int start = editorPane.getSelectionStart(); int end = editorPane.getSelectionEnd(); boolean isSelection = (end > start); if (!isSelection) { end++; } if (start >= 0) { int modelRow = annotationTableModel.find(start, end); if (modelRow < 0) { return; } int viewRow = annotationTable.getRowSorter().convertRowIndexToView(modelRow); annotationTable.getSelectionModel().setSelectionInterval(viewRow, viewRow); editorPane.setSelectionStart(annotationTableModel.getStart(modelRow)); editorPane.setSelectionEnd(annotationTableModel.getEnd(modelRow)); } }
moutput.setSelectionStart(0); moutput.setText(""); moduleOutput.addMouseListener(new java.awt.event.MouseAdapter() {