关于旋转text3dtext3d

2023-09-08 10:53:34 作者:落荒而逃的王

我们可以添加一个图标按钮

we can add one icon to the button

jButton1.setIcon(Icon c);

我们可以旋转的图像添加到按钮?(文字3D) 如果有,请帮我用一个简单的code.thanks

can we add a rotating image to the button?(text 3d) if yes,please help me with a simple code.thanks

推荐答案

该步骤中,您需要按照广义上说是:

The steps you'll need to follow broadly speaking are:

prepare每个动画帧作为单独的图像以编程方式或通过pre-载入多个图像到内存中。 在子类的JButton 和覆盖的paintComponent(图形)来应用新形象,将JButton(下一个动画帧)。 使用 javax.swing.Timer中的来触发一个的ActionEvent 定期(例如每50毫秒),导致其重绘将JButton。 Prepare each animation frame as a separate image either programmatically or by pre-loading a number of images into memory. Subclass JButton and override paintComponent(Graphics) to apply a new Image to the JButton (the next animation frame). Use javax.swing.Timer to fire an ActionEvent periodically (e.g. every 50ms), causing it to repaint the JButton.

您确定要做到这一点,虽然?它可能让你的用户界面看起来就像是写于80年代中期。

Are you sure you want to do this though? It might make your UI look like it was written in the mid-80s.

相关推荐