Am running Eclipse Luna Service Release 2 (4.4.2) on a Mac under OS X Yosemite version 10.10.5, Java and Postgres 9.4.
Can read from the database, but the problem is in printing on a printer from within Java. The following code is intended to pass the line to be printed to the method It does fill up the array of textLines.
If is used, it produces compile error: Cannot use this in a static context. – which makes sense, but how do I get it to directly display the PrintDialog, which is implemented code? The code in PaginationExample is implemented and an intermediary print window with a simple print button is used to display the PrintDialog. (- this I would not like to include.) Also, I have no listener.
First of all don't catch exceptions and then do nothing. If an exception is caught at the very least you should print a message and it normally helps if you dump the stack trace. If you don't do anything you won't know something has gone wrong unless your program crashes or exhibits unexpected behaviour and even then you won't know what has caused the problem.
is used, it produces compile error: Cannot use this in a static context.
'this' should be the object that renders your print so the line you have following this one is correct.
Have you tried putting System.out.println() statements in the print method to see what is being rendered for printing.
David Ellis Rogers
posted 3 years ago
Solved. I was calling the method rather than creating the class. Stupid error which I have been guilty of before.
Does this tiny ad smell okay to you?
Two software engineers solve most of the world's problems in one K&R sized book