旋转 JButton 的文本
我希望我的 JButton
在悬停时稍微旋转其文本(而不是整个按钮)。我该怎么做?
I want my JButton
to rotate its text (not the whole button) a bit when it's hovered. How do I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来您需要做两件事:
祝你好运,我希望这有帮助!
It sounds like you'll need to do 2 things:
Good luck, I hope this helps!
“稍微旋转文本”是什么意思?这样做的目的是什么。当您旋转文本时,当您到达按钮的边缘时,顶部和底部将被剪切。
我认为基本代码是这样的:
也许更好的解决方案是将文本向上/向下移动几个像素,而不是旋转,然后您不必担心截断。基本代码应该是相同的,但您将使用 translate(...) 方法。
What does "rotate the text a bit" mean? What is the purpose of this. As you rotate text the top and bottom will be clipped as you reach the edges of the button.
I think the basic code would be something like:
Instead of rotating maybe a better solution is to shift the text up/down a couple of pixels, then you don't have to worry about truncation. The basic code should be the same but you would use the translate(...) method.