Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个 JApplet,用户可以在其中在图像上绘制一些线条。线条可以是红色或绿色,但我需要突出显示它们,因为我不知道背景颜色。
所以我想我可以给这条线画一个白色的“边框”,我试着在原来的左边和右边创建另外两条白线。但结果很差。
有没有更好的方法来实现这个目标?
正如@Jesper 所提到的,首先使用较粗的线画线Stroke(如this answer所示)。
Stroke
字母上的黑色轮廓宽度为 2。
g.setStroke(new BasicStroke(2f));