Warning: session_start(): open(/var/lib/php/sessions/sess_spmch417m34ctuqhbplg8u6rhr, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
static class ShowBigText {
S fontID = "#1000993"; // Brother Deluxe Font
Color background = Color.white;
Color foreground = Color.black;
S text = "test";
ImageSurface is;
Font font;
S title = "JavaX";
// thread-safe
void showText(final S text) {
swing {
ShowBigText.this.text = text;
if (is == null) {
font = loadFont(fontID);
BufferedImage img = makeImage();
is = showImage(img, title);
moveToTopRightCorner(getFrame(is));
}
getFrame(is).setTitle(title);
is.setImage(makeImage());
}
}
BufferedImage makeImage() {
// TODO: dispose old image?
BufferedImage img = new BufferedImage(200, 60, BufferedImage.TYPE_INT_RGB);
Graphics g = img.getGraphics();
int w = img.getWidth(), h = img.getHeight();
g.setColor(background);
g.fillRect(0, 0, w, h);
g.setColor(foreground);
g.setFont(font.deriveFont(30f));
FontMetrics fm = g.getFontMetrics();
int y = fm.getAscent() + (h-fm.getHeight())/2;
int x = (w-fm.stringWidth(text))/2;
g.drawString(text, x, y);
g.dispose();
return img;
}
}