+ String message = null;
+ switch (status) {
+ case AltosSiteMapCache.loading:
+ message = "Loading...";
+ break;
+ case AltosSiteMapCache.bad_request:
+ message = "Internal error";
+ break;
+ case AltosSiteMapCache.failed:
+ message = "Network error, check connection";
+ break;
+ case AltosSiteMapCache.forbidden:
+ message = "Too many requests, try later";
+ break;
+ }
+ if (message != null && font != null) {
+ g2d.setFont(font);
+ g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+ Rectangle2D bounds;
+ bounds = font.getStringBounds(message, g2d.getFontRenderContext());
+
+ float x = getWidth() / 2.0f;
+ float y = getHeight() / 2.0f;
+ x = x - (float) bounds.getWidth() / 2.0f;
+ y = y - (float) bounds.getHeight() / 2.0f;
+ g2d.setColor(Color.BLACK);
+ g2d.drawString(message, x, y);
+ }