?? laboutchar.java
字號(hào):
package classes;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class LAboutChar extends JFrame implements ActionListener
{
JButton ok=new JButton("確定");
JTextArea text=new JTextArea();
JPanel p1=new JPanel();
String st;
LAboutChar(String s)
{
super(s);
Container con=this.getContentPane();
con.setLayout(new BorderLayout());
st= "F:從當(dāng)前位置向前走一步,同時(shí)畫線\n";
st=st+"+:從當(dāng)前方向向左轉(zhuǎn)一個(gè)給定的角度\n";
st=st+"-:從當(dāng)前方向向右轉(zhuǎn)一個(gè)給定的角度\n";
st=st+"[:Push,將龜圖當(dāng)前狀態(tài)壓進(jìn)棧(stack)\n";
st=st+"]:Pop,將圖形狀態(tài)重置為棧頂?shù)臓顟B(tài)并去掉該棧中的內(nèi)容\n";
st=st+"起始坐標(biāo):表示在繪畫面板中的起始點(diǎn)(0~560)\n";
st=st+"起始方向角:表示開始繪畫時(shí)的方向\n";
st=st+"給定的轉(zhuǎn)角:表示繪畫規(guī)則中有-或+時(shí)的轉(zhuǎn)角\n";
st=st+"每步的步長(zhǎng):表示一個(gè)F所走象素點(diǎn)數(shù)\n";
st=st+"迭代次數(shù):表示規(guī)則中反復(fù)替代次數(shù)\n";
st=st+"公理:開始繪畫的起始規(guī)則字符任意字符\n";
st=st+"規(guī)則:在各規(guī)則中有兩個(gè)文本框,第一個(gè)表示規(guī)則的起始字符\n";
st=st+"第二個(gè)表示該規(guī)則的具體走向,可以是其它規(guī)則中的任意字符";
this.setBackground(Color.gray);
text.setBackground(Color.blue);
text.setForeground(Color.yellow);
text.setText(st);
text.setEditable(false);
p1.setLayout(new GridLayout(1,5));
p1.add(new Label());
p1.add(new Label());
p1.add(ok);
p1.add(new Label());
p1.add(new Label());
con.add(text,"Center");
con.add(p1,"South");
ok.addActionListener(this);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{setVisible(false);}
});
setSize(320,360);
setResizable(false);
//獲取默認(rèn)的顯示器尺寸
Dimension d=Toolkit.getDefaultToolkit().getScreenSize();
//設(shè)置窗體顯示位置
setLocation((d.getSize().width-this.getSize().width)/2,(d.getSize().height-this.getSize().height)/2);
setVisible(true);
pack();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==ok)
{
this.setVisible(false);
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -