private void print_current_chart(PrintJob pj) { Graphics page = pj.getGraphics(); Dimension size = graph_panel.getSize(); Dimension pagesize = pj.getPageDimension(); main_graph.set_symbol(chart.current_tradable().toUpperCase()); if (size.width <= pagesize.width) { // Center the output on the page. page.translate((pagesize.width - size.width) / 2, (pagesize.height - size.height) / 2); } else { // The graph size is wider than a page, so print first // the left side, then the right side. Assumption - it is // not larger than two pages. page.translate(15, (pagesize.height - size.height) / 2); graph_panel.printAll(page); page.dispose(); page = pj.getGraphics(); page.translate(pagesize.width - size.width - 13, (pagesize.height - size.height) / 2); } graph_panel.printAll(page); page.dispose(); main_graph.set_symbol(null); }