Where does the code call any printer methods?Quote:
this does not work properly only the file reader bit does, no printer options is ever displayed
Do you know how to call a method?
http://docs.oracle.com/javase/tutori...arguments.html
Printable View
Where does the code call any printer methods?Quote:
this does not work properly only the file reader bit does, no printer options is ever displayed
Do you know how to call a method?
http://docs.oracle.com/javase/tutori...arguments.html
Thanks this was the issue, i did update the original question as i am now getting errors, but it seems to have vanished
There is a variable with a null value when line 14 is executed.Quote:
java.lang.NullPointerException
at java.text.AttributedString.<init>(AttributedString .java:127)
at PrintText.<init>(PrintText.java:14)
Look at line 14 and find the variable with the null value. Then backtrack in the code to see why that variable does not have a valid, non-null value.
Please edit your post and wrap your code with
[code=java]
<YOUR CODE HERE>
[/code]
to get highlighting and preserve formatting.
Thank you, the code at line 14 was in the wrong place, i have now put this into the print method, however i am now getting this error
Code :Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at java.text.AttributedString.<init>(AttributedString.java:127) at PrintText.print(PrintText.java:109) at sun.print.RasterPrinterJob.printPage(RasterPrinterJob.java:1973) at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1461) at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1277) at PrintText.printer(PrintText.java:98) at PrintText$1.run(PrintText.java:52) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:682) at java.awt.EventQueue$3.run(EventQueue.java:680) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:691) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
Now look at line 109 the same way you looked at line 14 in the previous error.Quote:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.text.AttributedString.<init>(AttributedString .java:127)
at PrintText.print(PrintText.java:109)