Java - 在 Swing 中加入多个绘图字符串
在 Swing 的面板中,我使用 PaintComponent 使用 Graphics2D 绘制具有不同坐标的字符串:
g2.drawString("one", 0, 0);
g2.drawString("two", 50, 50);
有没有一种方法可以将多个生成的绘图合并到一个绘图字符串中?
编辑:我基本上使用 unicode 字符绘制一个五线谱,并且我想绘制另一个五线谱。我希望有一种干净的方式来复制它。
In Swing, in a panel, I use paintComponent to draw strings with different coordinates using Graphics2D:
g2.drawString("one", 0, 0);
g2.drawString("two", 50, 50);
Is there a way to combine the multiple resulting drawings into one drawString?
Edit: I basically draw a musical stave using unicode characters, and I want to draw another stave. I was hoping there would be a clean way of duplicating it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
示例代码。
Sample code.
不,没有办法做到这一点。但您希望通过这种结合实现什么目标?更好的性能?一些具体的布局?
No, there is no way to do it. But what do you wish to achieve with such combining? Better performance? Some specific layout?