0
如何使用jButton从TextArea打印文本?我使用NetBeans,顺便说一句。谁能帮我?这是我在学校的中期项目。如何使用java中的jButton在TextArea中打印文本?
如何使用jButton从TextArea打印文本?我使用NetBeans,顺便说一句。谁能帮我?这是我在学校的中期项目。如何使用java中的jButton在TextArea中打印文本?
使用textarea的getText()方法获取文本。使用System.out.println()在控制台中打印它,或者如果不是控制台,请按照您的方法进行操作。在JButton的事件处理程序中执行这些操作。
public void actionPerformed(ActionEvent aew)
{
JTextArea text = new JTextArea();
String result = text.getText();
}
我的意思是,真正从打印机打印。从程序本身打印某些东西的代码。 :( – 2012-07-30 09:48:16
好的,请在将来明确您的问题。看看这里 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