我需要在图像的中心写文字.要写的文字并不总是一样的.
我正在使用的代码在这里:
// Here I first draw the image
g.drawImage(img, 22, 15, 280, 225, null);
// I get the text
String text = photoText.getText();
// Set the text color to black
g.setColor(Color.black);
// I draw the string
g.drawString(text, 79.5F, 220.0F);
Run Code Online (Sandbox Code Playgroud)
问题是文本不在图像的中心,我该怎么办?
我只需要在水平中心绘制文字.
我有一个Scaleway VPS我在哪里运行码头工人,我试图让我们先从Traefik加密工作.这是我的traefik.toml:
defaultEntryPoints = ["http", "https"]
debug = true
logLevel = "DEBUG"
[web]
address = ":8080"
[web.auth.basic]
users = ["admin:$apr1$CXbUFy59$gnQY50uMvzc3Q5tnhA2ZZ."]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[retry]
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "viatecnologia.it"
watch = true
exposedbydefault = false
[acme]
email = "admin@viatecnologia.it"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
[acme.dnsChallenge]
provider = "ovh"
delayBeforeCheck = 0
onDemand = false
[[acme.domains]]
main = "viatecnologia.it"
sans = ["www.viatecnologia.it"]
sub = …Run Code Online (Sandbox Code Playgroud) docker ×1
graphics ×1
graphics2d ×1
imageicon ×1
java ×1
lets-encrypt ×1
ovh ×1
swing ×1
traefik ×1