2012-07-29 91 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