本文整理了Java中javax.swing.text.JTextComponent.read()
方法的一些代码示例,展示了JTextComponent.read()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextComponent.read()
方法的具体详情如下:
包路径:javax.swing.text.JTextComponent
类名称:JTextComponent
方法名:read
暂无
代码示例来源:origin: stackoverflow.com
edit.read( br, null );
br.close();
edit.requestFocus();
代码示例来源:origin: stackoverflow.com
static void readin(String fn, JTextComponent pane)
{
try
{
FileReader fr = new FileReader(fn);
pane.read(fr, null);
fr.close();
}
catch (IOException e)
{
System.err.println(e);
}
}
代码示例来源:origin: stackoverflow.com
try {
Reader reader = new FileReader(f);
out.read(reader, f);
} catch (Exception ex) {
ex.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(0, pane.getText().indexOf("\n"), painter);
}
catch (IOException e) {
System.err.println(e);
} catch (BadLocationException e) {
e.printStackTrace();
}
}
代码示例来源:origin: stackoverflow.com
final JTextArea textArea = new JTextArea(20, 40);
textArea.read(br, null); // here we read in the text file
代码示例来源:origin: stackoverflow.com
File f = new File("TextAreaWrapChooser.java");
FileReader fr = new FileReader(f);
text.read( fr, f );
} catch(Exception weTried) {
代码示例来源:origin: stackoverflow.com
textpanel.read(reader, fstream);
}catch(Exception e){System.err.println("Error: " + e.getMessage());}
textpanel.setBounds(100, 222, 593, 528);
代码示例来源:origin: stackoverflow.com
rightTextArea.read(new FileReader("C:\\Denemeler\\deneme2.txt"), null);
} catch (FileNotFoundException e) {
System.out.println(e);
JScrollPane rightPane1 = new JScrollPane(leftTextArea);
try {
leftTextArea.read(new FileReader("C:\\Denemeler\\deneme1.txt"), null);
} catch (FileNotFoundException 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: stackoverflow.com
JTextArea text = new JTextArea(24, 32);
try {
text.read(new BufferedReader(new FileReader(NAME)), null);
} catch (IOException ex) {
ex.printStackTrace(System.err);
代码示例来源:origin: stackoverflow.com
editor.setContentType( "text/html" );
editor.setEditable( false );
editor.read(reader, null);
System.out.println(editor.getText());
System.out.println("\n------------\n");
代码示例来源:origin: stackoverflow.com
JEditorPane editor = new JEditorPane();
editor.setContentType("text/html");
editor.read(fr, "Test");
代码示例来源:origin: stackoverflow.com
InputStreamReader reader = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(reader);
edit.read( br, null );
br.close();
edit.requestFocus();
代码示例来源:origin: stackoverflow.com
ta.read(reader, ta);
} catch (IOException ex) {
ex.printStackTrace();
代码示例来源:origin: stackoverflow.com
try {
text.read(new FileReader(file.getAbsolutePath()), null);
} catch (IOException ex) {
代码示例来源:origin: stackoverflow.com
textArea.read( br, null );
br.close();
代码示例来源:origin: stackoverflow.com
html.read(reader, null);
代码示例来源:origin: stackoverflow.com
try (Reader reader = new BufferedReader(new InputStreamReader(
new FileInputStream("SelectionTypeTest.java"), "UTF-8"))) {
textArea.read(reader, "");
} catch (Exception ex) {
ex.printStackTrace();
代码示例来源:origin: stackoverflow.com
textArea.read( br, null );
br.close();
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
@Override
public void read( IScriptPartId partId, String strSource ) throws IOException
{
setScriptPart( partId );
setLabel( "" );
JTextComponent editor = getEditor();
AbstractDocument doc = (AbstractDocument)editor.getDocument();
if( doc != null )
{
doc.removeDocumentListener( getDocHandler() );
}
// Replace the Windows style new-line sequence with just a new-line.
// Otherwise, the editor thinks new lines are one character
strSource = GosuStringUtil.replace( strSource, "\r\n", "\n" );
editor.read( new StringReader( strSource ), "" );
addDocumentListener();
parse();
}
内容来源于网络,如有侵权,请联系作者删除!