我有一个包含 10 行信息的文本文件。如何在 JTextArea 中复制粘贴该信息?
public void createPage4()
{
panel4 = new JPanel();
panel4.setLayout( new BorderLayout() );
BufferedReader log=null;
try {
FileReader logg =new FileReader("logsheet.txt");
log = new BufferedReader(logg);
textArea = new JTextArea("how do I get all the content of logsheet, I can get it on the command window as shown below");
for (int x = 0 ; x<10; x++){
System.out.println(log.readLine());
}
panel4.add(textArea);