@Override protected void paintComponent(Graphics g) { g.setColor(Color.WHITE); Rectangle b = infoPanel.getBounds(); g.fillRect(0, 0, b.width, b.height); g.setColor(Color.BLUE); g.drawString(latLon, 40, 20); g.drawString("scale:" + mg.getScaleX(), 40, 40); int w = mainPanel.getBounds().width; int h = mainPanel.getBounds().height; g.drawString(mg.setBounds(0, w, 0, h).toLessPrecisionString(), 40, 60); } };