I'm working on an application where I create a graph. The class that paints the graph is defined as following:
I override paintComponent(Graphics g) to do the painting. The actual graph consists of lines (g.drawLine(fromX, fromY, toX, toY)) and some homemade JComponents (myComponent.setBounds(x, y, a, b)) such as small squares and circles. I use these JComponents because I want Tool Tips on them.
On the screen all looks great!
Here's how I print:
But when I try to print it, the outcome on paper doesn't look that great:
All my homemade JComponents are stacked in upper left corner (coords 0, 0) instead of being placed correctly I'm aware that PrinterJob takes the Graphics object, does some transformations and then pipes it to the printer, but why are my components parintet but their coordinates ignored?
What to do .. what to do .. pretty annoying, actually