小编Ghz*_*Ncl的帖子

Java - 在图像的中心绘制文本

我需要在图像的中心写文字.要写的文字并不总是一样的.

我正在使用的代码在这里:

// 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)

问题是文本不在图像的中心,我该怎么办?

我只需要在水平中心绘制文字.

java graphics swing graphics2d imageicon

5
推荐指数
3
解决办法
1万
查看次数

Traefik +让我们加密OVH域名

我有一个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 ovh lets-encrypt traefik

5
推荐指数
0
解决办法
1615
查看次数

标签 统计

docker ×1

graphics ×1

graphics2d ×1

imageicon ×1

java ×1

lets-encrypt ×1

ovh ×1

swing ×1

traefik ×1