textPane.paint(g);
JFrame neuFrame = new JFrame();neuFrame.setContentPane(textPane);neuFrame.pack();neuFrame.dispose();// in der Methode print(...)textPane.paint(g);