java下降矩阵代码(如电影) [英] java falling matrix code (like the movie)

查看:173
本文介绍了java下降矩阵代码(如电影)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果你想用java编写一个使用JFrame的程序来使用ascii字符串字符来模拟矩阵电影中的绿色代码,所以它看起来和这个php例子完全一样。



http: //mgccl.com/2007/03/30/simple-version-matrix-like-animated-dropping-character-effect-in-php

最好的办法是什么?标签,drawString?等等...我知道在一个for循环中,例如你可以使用整数值i来减小y轴的值,使setColor(new颜色(255,255 - (i * 5),255));

但我不知道如何将印记留在后面。



谢谢 解决方案

示例显示了如何使用alpha透明度淡入文本,而此示例说明了如何淡入淡出文本通过改变颜色饱和度。



附录:


什么是最好的GUI布局使用?


我想在单个列中解决问题 JPanel 与选定的 Font 一样宽,并且任意高。使用 javax.swing。定时器 来控制动画。然后使用 新的GridLaylout( 1,0) 将任意数量的这样的列包含为一行。


If you wanted to write a program in java that uses a JFrame to simulate the falling green code from the matrix movie using ascii string characters so it looks exactly like this php example

http://mgccl.com/2007/03/30/simple-version-matrix-like-animated-dropping-character-effect-in-php

what would be the best way of doing it? labels, drawString? etc...

I know that within a for-loop for example you could use the integer value i to decrease the y-axis values, darken the color setColor(new Color(255, 255 - (i * 5), 255));

but i don't know how you would leave the "imprint" behind.

thanks

解决方案

This example shows how to fade text using alpha transparency, while this example illustrates how to fade text by varying the color saturation.

Addendum:

What would be the best gui layout to use?

I'd solve the problem in a single, columnar JPanel that is as wide as the chosen Font and arbitrarily tall. Use a javax.swing.Timer to control animation. Then use a new GridLaylout(1, 0) to contain any number of such columns as a single row.

这篇关于java下降矩阵代码(如电影)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆