本文整理了Java中javax.swing.JTextPane.select()
方法的一些代码示例,展示了JTextPane.select()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextPane.select()
方法的具体详情如下:
包路径:javax.swing.JTextPane
类名称:JTextPane
方法名:select
暂无
代码示例来源:origin: beanshell/beanshell
private String replaceRange(Object s, int start, int end) {
String st = s.toString();
text.select(start, end);
text.replaceSelection(st);
//text.repaint();
return st;
}
代码示例来源:origin: com.itextpdf/itext-rups
public void actionPerformed(ActionEvent e) {
boolean nothingSelected = false;
JTextPane textPane = (JTextPane) invoker;
if (textPane.getSelectedText() == null || textPane.getSelectedText().trim().length() == 0) {
nothingSelected = true;
textPane.selectAll();
}
textPane.copy();
if (nothingSelected) {
textPane.select(0, 0);
}
}
代码示例来源:origin: stackoverflow.com
public WarnaText(JTextPane source) throws BadLocationException
{
source.setForeground(Color.BLACK);
Matcher komen=Pattern.compile("(/\\*([^\\*]|(\\*(?!/))+)*+\\*+/)|(\\/\\/.+)").matcher(source.getText());
while(komen.find())
{
StyleContext sc = StyleContext.getDefaultStyleContext();
AttributeSet aset = sc.addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, Color.RED);
aset = sc.addAttribute(aset, StyleConstants.FontFamily, "Concolas");
source.select(komen.start(),komen.end());
source.setCharacterAttributes(aset, false);
}
}
代码示例来源:origin: com.itextpdf/itext-rups
textPane.select(0, 0);
代码示例来源:origin: beanshell/beanshell
private void append(String string) {
int slen = textLength();
text.select(slen, slen);
text.replaceSelection(string);
}
代码示例来源:origin: net.imagej/imagej-ui-swing
protected void selectEnd() {
final int end = panel.getStyledDocument().getLength();
panel.select(end, end);
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
/**
* Accessor for text area.
* This is used by Actions that need ot act on the text area of the View.
*/
public void select(int start, int end) {
editor.select(start, end);
try {
editor.scrollRectToVisible(editor.modelToView(start));
} catch (BadLocationException e) {
e.printStackTrace();
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-toolchain-ui
tpInstall.setText(message);
tpInstall.setBackground(getBackground());
tpInstall.select(tpInstall.getDocument().getLength()-1, tpInstall.getDocument().getLength()-1);
} else {
isUrl = false;
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-toolchain
tpInstall.setText(message);
tpInstall.setBackground(getBackground());
tpInstall.select(tpInstall.getDocument().getLength()-1, tpInstall.getDocument().getLength()-1);
} else {
isUrl = false;
代码示例来源:origin: com.github.cfparser/cfml.parsing
@Override
public void mouseClicked(MouseEvent e) {
if (tree.getLastSelectedPathComponent() instanceof TreeNode) {
TreeNode node = (TreeNode) tree.getLastSelectedPathComponent();
if (node.getTextRange().start != -1 && node.getTextRange().end != -1) {
// select the corresponding range in the editor
editor.select(node.getTextRange().start, node.getTextRange().end + 1);
editor.grabFocus();
}
}
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
if (alignFound) {
sasPara.addAttribute(HTML.Attribute.ALIGN, a_);
if (textLength > 0) parentTextPane.select(caretOffset, caretOffset + textLength);
parentTextPane.setParagraphAttributes(sasPara, true);
} else if (textLength < 0) {
parentTextPane.setParagraphAttributes(sasPara, true);
sasText.addAttribute(p_, attribs);
if (textLength > 0) parentTextPane.select(caretOffset, caretOffset + textLength);
parentTextPane.setCharacterAttributes(sasText, true);
if (textLength > 0) parentTextPane.select(caretOffset, caretOffset + internalTextLength);
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
for(int i = caretOffset; i < caretOffset + internalTextLength; i++)
parentTextPane.select(i, i + 1);
sasText = new SimpleAttributeSet(parentTextPane.getCharacterAttributes());
Enumeration attribEntries1 = sasText.getAttributeNames();
parentTextPane.select(caretOffset, caretOffset + internalTextLength);
SimpleAttributeSet sasTag = new SimpleAttributeSet();
SimpleAttributeSet sasAttr = new SimpleAttributeSet();
parentEkit.refreshOnUpdate();
parentTextPane.select(caretOffset, caretOffset + internalTextLength);
parentTextPane.requestFocus();
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
int caret = this.getCaretPosition();
String tempString = this.getTextPane().getText(caret, eo - caret);
this.getTextPane().select(caret, eo - 1);
this.getTextPane().replaceSelection("");
htmlUtilities.insertListElement(tempString);
内容来源于网络,如有侵权,请联系作者删除!