📄 trees3d.java
字号:
// Trees3D.java// Andrew Davison, November 2003, dandrew@ratree.psu.ac.th/* Illustrates techniques for simulating growth, applied to trees that grow and sprout leaves. 1. Use scaling to gradually stretch cylinders representing tree limbs. 2. Incrementally change the colour of the cylinders from green to blue. 3. Leaves on a tree limb are actually just a single image on a 'screen'. The image can be replaced by another one, which contains more leaves, creating the effect that the leaves are 'growing'. The changes carried out on a tree limb in each time frame are specified by 'rules' in the GrowthBehavior object. These can be adjusted to make a variety of different effects.*/import javax.swing.*;import java.awt.*;import java.awt.event.*;public class Trees3D extends JFrame{ public Trees3D() { super("Trees3D"); Container c = getContentPane(); c.setLayout( new BorderLayout() ); WrapTrees3D w3d = new WrapTrees3D(); // panel holding the 3D canvas c.add(w3d, BorderLayout.CENTER); setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); pack(); setResizable(false); // fixed size display show(); } // end of Trees3D()// ----------------------------------------- public static void main(String[] args) { new Trees3D(); }} // end of Trees3D class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -