本文整理了Java中javax.swing.text.JTextComponent.setHighlighter()
方法的一些代码示例,展示了JTextComponent.setHighlighter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextComponent.setHighlighter()
方法的具体详情如下:
包路径:javax.swing.text.JTextComponent
类名称:JTextComponent
方法名:setHighlighter
暂无
代码示例来源:origin: stackoverflow.com
static void readin(String fn, JTextComponent pane) {
try {
FileReader fr = new FileReader(fn);
pane.read(fr, null);
fr.close();
Highlighter hilit = new DefaultHighlighter();
Highlighter.HighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(Color.yellow);
pane.setHighlighter(hilit);
hilit.addHighlight(0, pane.getText().indexOf("\n"), painter);
}
catch (IOException e) {
System.err.println(e);
} catch (BadLocationException e) {
e.printStackTrace();
}
}
代码示例来源:origin: stackoverflow.com
static void readin(String fn, JTextComponent pane) {
try {
FileReader fr = new FileReader(fn);
pane.read(fr, null);
fr.close();
Highlighter hilit = new DefaultHighlighter();
Highlighter.HighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(Color.yellow);
pane.setHighlighter(hilit);
hilit.addHighlight(getLineEndIdx(pane.getText(), 4), getLineEndIdx(pane.getText(), 8 ), painter);
}
catch (IOException e) {
System.err.println(e);
} catch (BadLocationException e) {
e.printStackTrace();
}
}
private static int getLineEndIdx(String text, int lineNo) {
int lineEndIdx = 0;
for(int i = 1; i <= lineNo && lineEndIdx + 1 < text.length(); i++)
{
lineEndIdx = text.indexOf('\n', lineEndIdx + 1) ;
}
return lineEndIdx;
}
代码示例来源:origin: org.xworker/xworker_core
public static void createHighlighter(ActionContext actionContext){
Thing self = (Thing) actionContext.get("self");
JTextComponent parent = (JTextComponent) actionContext.get("parent");
for(Thing child : self.getChilds()){
Highlighter l = (Highlighter) child.doAction("create", actionContext);
if(l != null){
parent.setHighlighter(l);
break;
}
}
}
代码示例来源:origin: stackoverflow.com
hilit = new DefaultHighlighter();
painter = new DefaultHighlighter.DefaultHighlightPainter(HILIT_COLOR);
textArea.setHighlighter(hilit);
textArea.getDocument().addDocumentListener(this);
代码示例来源:origin: stackoverflow.com
Highlighter highlighter = new DefaultHighlighter();
final DefaultHighlightPainter painter = new DefaultHighlightPainter(Color.pink);
textarea.setHighlighter(highlighter);
代码示例来源:origin: stackoverflow.com
jTextArea.setHighlighter(hilit);
Scanner scan=new Scanner(System.in);
System.out.println("enter some text \n");
代码示例来源:origin: stackoverflow.com
hilit = new DefaultHighlighter();
painter = new DefaultHighlighter.DefaultHighlightPainter(HILIT_COLOR);
textArea.setHighlighter(hilit);
代码示例来源:origin: stackoverflow.com
field.setForeground(Color.WHITE);
field.setBounds(2, frame.getHeight() - 23, frame.getWidth() - 5, 20);
field.setHighlighter(null);
field.setCaretColor(Color.BLACK);
field.addKeyListener(this);
代码示例来源:origin: stackoverflow.com
textComponent.setHighlighter( null );
代码示例来源:origin: stackoverflow.com
textComponent.setHighlighter( null );
代码示例来源:origin: stackoverflow.com
textPane.setHighlighter(highlighter);
textPane.setText("This text pane contains no html. It supports letter wrapping, "
+ "\nThis text pane contains no html. It supports letter wrapping!, "
代码示例来源:origin: stackoverflow.com
textPane.setHighlighter(highlighter);
textPane.setText("This text pane contains no html. It supports letter wrapping, "
+ "\nThis text pane contains no html. It supports letter wrapping!, "
代码示例来源:origin: org.jclarion/clarion-runtime
jta.setHighlighter(dh);
spellCheck(jta);
代码示例来源:origin: stackoverflow.com
this.doc = new DefaultStyledDocument();
this.scrollPane = new JScrollPane(this.textPane);
this.textPane.setHighlighter(this.hilit);
代码示例来源:origin: org.swinglabs.swingx/swingx-all
promptComponent.setHighlighter(new PainterHighlighter(PromptSupport
.getBackgroundPainter(txt)));
promptComponent.setEnabled(txt.isEnabled());
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
promptComponent.setHighlighter(new PainterHighlighter(PromptSupport
.getBackgroundPainter(txt)));
promptComponent.setEnabled(txt.isEnabled());
代码示例来源:origin: org.swinglabs.swingx/swingx-core
promptComponent.setHighlighter(new PainterHighlighter(PromptSupport
.getBackgroundPainter(txt)));
promptComponent.setEnabled(txt.isEnabled());
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
promptComponent.setHighlighter(new PainterHighlighter(PromptSupport
.getBackgroundPainter(txt)));
promptComponent.setEnabled(txt.isEnabled());
内容来源于网络,如有侵权,请联系作者删除!