2012-07-29 102 views

回答

1

使用textarea的getText()方法获取文本。使用System.out.println()在控制台中打印它,或者如果不是控制台,请按照您的方法进行操作。在JButton的事件处理程序中执行这些操作。

public void actionPerformed(ActionEvent aew) 
{ 
    JTextArea text = new JTextArea(); 

    String result = text.getText(); 
} 
+0

我的意思是,真正从打印机打印。从程序本身打印某些东西的代码。 :( – 2012-07-30 09:48:16

+0

好的,请在将来明确您的问题。看看这里 1. http://docs.oracle.com/javase/tutorial/2d/printing/index.html 2. http:// stackoverflow.com/questions/3959064/how-to-print-documents-using-java – 2012-07-30 14:25:48