?? applet1.java
字號:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: Applet1.java
import java.applet.Applet;
import java.awt.Adjustable;
import java.awt.Button;
import java.awt.Canvas;
import java.awt.Checkbox;
import java.awt.CheckboxGroup;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Label;
import java.awt.Panel;
import java.awt.ScrollPane;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.EventObject;
public class Applet1 extends Applet
implements ActionListener
{
public ScrollPane lsp;
public ScrollPane rsp;
public Button begin;
public Button next;
public Button reset;
public TextField tf1;
public Adjustable rha;
public Adjustable rva;
public Adjustable lha;
public Adjustable lva;
public Label la1;
public Panel pa;
public int wsize;
public int hsize;
public Font f;
lcanvas4_1 ca1;
rcanvas4_1 ca2;
int height;
int width;
int sel;
int lpheight;
int lpwidth;
int pheight;
int pwidth;
FontMetrics fm;
int wid;
int heig;
int token;
int tokenp;
boolean nowldev;
CheckboxGroup cbg;
Checkbox ldev;
Checkbox rdev;
int bufl[][] = {
{
6, 1, 2, 3, 5, 4, 0, 1, 3, 5,
3, 5
}, {
-1, 5, 3, 5, 3, 1, 5, 3, 0, 4,
2, 1
}
};
TextField textField1;
Button my_description;
Panel panel1;
CheckboxGroup Group1;
Checkbox radioButton3;
Label label1;
java.awt.List list1;
Label label2;
Label label3;
final int TNFA = 0;
final int TDFA = 1;
final int TMINDFA = 2;
int FAtype;
Canvas canvas1;
public void onclickdesc()
{
ca2.state = 1;
ca2.repaint();
}
void drawtoken(Graphics g, int num, int k1, int y)
{
int k2 = k1 + width / 2;
String s2;
String s3;
String s1 = s2 = s3 = null;
switch(num)
{
case 0: // '\0'
s1 = "E";
s2 = "+";
s3 = "T";
break;
case 2: // '\002'
s1 = "T";
s2 = "*";
s3 = "F";
break;
case 4: // '\004'
s1 = "(";
s2 = "E";
s3 = ")";
break;
case 1: // '\001'
s1 = "T";
break;
case 3: // '\003'
s1 = "F";
break;
case 5: // '\005'
s1 = "id";
break;
}
if(num % 2 == 0)
{
mydrawnode(g, k2, y, k2 - wid, (y + heig) - height, s1);
mydrawnode(g, k2, y, k2, (y + heig) - height, s2);
mydrawnode(g, k2, y, k2 + wid, (y + heig) - height, s3);
} else
{
mydrawnode(g, k2, y, k2, (y + heig) - height, s1);
}
}
void drawconclude(Graphics g)
{
int x = 2 * width;
int y = 7 * height;
if(nowldev)
switch(token)
{
case 11: // '\013'
g.drawString("==>id*(id+id)", x, y + 11 * height);
// fall through
case 10: // '\n'
g.drawString("==>id*(id+F)", x, y + 10 * height);
// fall through
case 9: // '\t'
g.drawString("==>id*(id+T)", x, y + 9 * height);
// fall through
case 8: // '\b'
g.drawString("==>id*(F+T)", x, y + 8 * height);
// fall through
case 7: // '\007'
g.drawString("==>id*(T+T)", x, y + 7 * height);
// fall through
case 6: // '\006'
g.drawString("==>id*(E+T)", x, y + 6 * height);
// fall through
case 5: // '\005'
g.drawString("==>id*(E)", x, y + 5 * height);
// fall through
case 4: // '\004'
g.drawString("==>id*F", x, y + 4 * height);
// fall through
case 3: // '\003'
g.drawString("==>F*F", x, y + 3 * height);
// fall through
case 2: // '\002'
g.drawString("==>T*F", x, y + 2 * height);
// fall through
case 1: // '\001'
g.drawString("==>T", x, y + height);
// fall through
case 0: // '\0'
g.drawString("E", x, y);
break;
}
else
switch(token)
{
case 11: // '\013'
g.drawString("E", x, y);
// fall through
case 10: // '\n'
g.drawString("==>T", x, y + height);
// fall through
case 9: // '\t'
g.drawString("==>T*F", x, y + 2 * height);
// fall through
case 8: // '\b'
g.drawString("==>T*(E)", x, y + 3 * height);
// fall through
case 7: // '\007'
g.drawString("==>T*(E+T)", x, y + 4 * height);
// fall through
case 6: // '\006'
g.drawString("==>T*(E+F)", x, y + 5 * height);
// fall through
case 5: // '\005'
g.drawString("==>T*(E+id)", x, y + 6 * height);
// fall through
case 4: // '\004'
g.drawString("==>T*(T+id)", x, y + 7 * height);
// fall through
case 3: // '\003'
g.drawString("==>T*(F+id)", x, y + 8 * height);
// fall through
case 2: // '\002'
g.drawString("==>T*(id+id)", x, y + 9 * height);
// fall through
case 1: // '\001'
g.drawString("==>F*(id+id)", x, y + 10 * height);
// fall through
case 0: // '\0'
g.drawString("==>id*(id+id)", x, y + 11 * height);
break;
}
}
void mydrawnode(Graphics g, int x0, int y0, int x1, int y1, String s)
{
g.drawLine(x0, y0 + height / 2, x1, y1);
g.drawOval(((x1 - height) + width / 2) - 2, y1, (height * 3) / 2, (height * 3) / 2);
Color oldcol = g.getColor();
g.setColor(Color.green);
g.fillArc(((x1 - height) + width / 2) - 1, y1 + 1, (height * 3) / 2 - 2, (height * 3) / 2 - 1, 0, 360);
g.setColor(oldcol);
g.drawString(s, x1 - width / 2, y1 + height);
}
public void repaint()
{
ca1.repaint();
ca2.repaint();
}
public Applet1()
{
lsp = null;
rsp = null;
begin = null;
next = null;
reset = null;
tf1 = null;
la1 = null;
pa = null;
ca1 = null;
ca2 = null;
FAtype = 0;
}
public void onclicknext()
{
ca2.state = 0;
deal();
repaint();
}
public void lupdate()
{
Graphics gg = ca1.getGraphics();
gg.setFont(f);
fm = gg.getFontMetrics();
height = fm.getHeight();
width = fm.charWidth('E');
wid = width * 8;
heig = height * 5;
Graphics tg = ca1.getGraphics();
tg.setFont(f);
tg.clearRect(0, 0, 300, 700);
int posv = 2 * height;
int posh = width * 2;
tg.setColor(Color.black);
tg.drawString("G[E]", posh - 5, posv);
tg.drawString("E--> E+T|T", posh, posv += height);
tg.drawString("T--> T*F|F", posh, posv += height);
tg.drawString("F--> (E)|id", posh, posv += height);
posv = 2 * height;
tg.setColor(Color.red);
switch(sel)
{
case 0: // '\0'
tg.drawString("E--> E+T", posh, posv += height);
break;
case 1: // '\001'
tg.drawString("E-->", posh, posv += height);
tg.drawString("T", posh + fm.stringWidth("E--> E+T|"), posv);
break;
case 2: // '\002'
tg.drawString("T--> T*F", posh, posv += 2 * height);
break;
case 3: // '\003'
tg.drawString("T-->", posh, posv += 2 * height);
tg.drawString("F", posh + fm.stringWidth("T--> T*F|"), posv);
break;
case 4: // '\004'
tg.drawString("F--> (E)", posh, posv += 3 * height);
break;
case 5: // '\005'
tg.drawString("F-->", posh, posv += 3 * height);
tg.drawString("id", posh + fm.stringWidth("F--> (E)|"), posv);
break;
case 6: // '\006'
tg.drawString("E", posh, posv += height);
break;
}
tg.setColor(Color.black);
drawconclude(tg);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource() == begin)
onclickbegin();
else
if(ae.getSource() == next)
onclicknext();
else
if(ae.getSource() == reset)
onclickreset();
else
if(ae.getSource() == my_description)
onclickdesc();
}
void drawtree(Graphics g)
{
int k1 = 2 * wid + width / 2;
int y = width * 2;
if(nowldev)
switch(token)
{
case 11: // '\013'
if(token == 11)
g.setColor(Color.red);
drawtoken(g, 5, k1 + 2 * wid, y + 5 * heig);
if(token == 11)
g.setColor(Color.black);
// fall through
case 10: // '\n'
if(token == 10)
g.setColor(Color.red);
drawtoken(g, 3, k1 + 2 * wid, y + 4 * heig);
if(token == 10)
g.setColor(Color.black);
// fall through
case 9: // '\t'
if(token == 9)
g.setColor(Color.red);
drawtoken(g, 5, k1, y + 6 * heig);
if(token == 9)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -