我有一个简单的java Netbeans GUI购物应用程序,带有简单的结帐。我想打印一个JTextField`值(结账价格)作为账单?
try {
boolean complete = textComponent.print();
if (complete) {
/* show a success message */
...
} else {
/*show a message indicating that printing was cancelled */
...
}
} catch (PrinterException pe) {
/* Printing failed, report to the user */
...
}
如何更改此代码才能实现这一目标?
答案 0 :(得分:0)
我想你想获得JTextField的值。
String text = textField.getText();