📄 guessnumber.jad
字号:
// Decompiled by DJ v3.8.8.85 Copyright 2005 Atanas Neshkov Date: 2007-9-7 9:23:27
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: GuessNumber.java
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class GuessNumber extends JApplet
{
class SysAction
implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
Object object = event.getSource();
if(object == button1)
buttonAction1(event);
if(object == button2)
buttonAction2(event);
if(object == button3)
buttonAction3(event);
if(object == button4)
buttonAction4(event);
if(object == button5)
buttonAction5(event);
}
final GuessNumber this$0;
SysAction()
{
this$0 = GuessNumber.this;
super();
}
}
public GuessNumber()
{
list1 = new JTextField();
list2 = new JTextField();
list3 = new JTextField();
button5 = new JButton();
list = new JTextField();
button1 = new JButton();
button2 = new JButton();
button3 = new JButton();
button4 = new JButton();
}
public void init()
{
try
{
EventQueue.invokeAndWait(new Runnable() {
public void run()
{
initComponent();
}
final GuessNumber this$0;
{
this$0 = GuessNumber.this;
super();
}
});
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
public void initComponent()
{
setLayout(null);
setSize(500, 366);
add(list1);
list1.setBackground(new Color(255, 255, 255));
list1.setText("");
list1.setBounds(120, 110, 285, 30);
list1.setFont(new Font("\u5B8B\u4F53", 1, 24));
add(list2);
list2.setBackground(new Color(255, 255, 255));
list2.setText("");
list2.setBounds(120, 140, 285, 30);
list2.setFont(new Font("\u5B8B\u4F53", 1, 24));
add(list3);
list3.setBackground(new Color(255, 255, 255));
list3.setText("");
list3.setBounds(120, 170, 285, 30);
list3.setFont(new Font("\u5B8B\u4F53", 1, 24));
add(button1);
button1.setBackground(new Color(153, 153, 153));
button1.setBounds(20, 50, 85, 30);
button1.setText("\u521D\u7EA7");
list.setBackground(new Color(255, 255, 255));
button2.setBackground(new Color(153, 153, 153));
button3.setBackground(new Color(153, 153, 153));
button4.setBackground(new Color(153, 153, 153));
button5.setBackground(new Color(153, 153, 153));
button2.setBounds(20, 80, 85, 30);
button3.setBounds(20, 110, 85, 30);
button4.setBounds(20, 140, 85, 30);
button5.setBounds(20, 170, 85, 30);
button2.setText("\u9AD8\u7EA7");
button3.setText("\u63D0\u4EA4");
button4.setText("\u63D0\u793A");
button5.setText("\u4F5C\u5F0A");
add(button2);
add(button3);
add(button4);
add(button5);
add(list);
list.setBounds(120, 50, 285, 60);
list.setFont(new Font("\u5B8B\u4F53", 1, 24));
list.setText("");
SysAction Action = new SysAction();
button1.addActionListener(Action);
button2.addActionListener(Action);
button3.addActionListener(Action);
button4.addActionListener(Action);
button5.addActionListener(Action);
}
void buttonAction1(ActionEvent event)
{
list1.setText("");
list2.setText("");
list3.setText("");
rand = (int)(Math.random() * 9D + 1.0D);
list.setText("\u8BF7\u4ECE1-9\u4E2D\u9009\u62E9\u4F60\u731C\u7684\u6570");
String str1 = list.getText();
answer = Integer.parseInt(str1);
}
void buttonAction2(ActionEvent event)
{
list1.setText("");
list3.setText("");
list2.setText("");
rand = (int)(Math.random() * 99D + 1.0D);
list.setText("\u8BF7\u4ECE1-99\u4E2D\u9009\u62E9\u4F60\u731C\u7684\u6570");
}
void buttonAction3(ActionEvent event)
{
String str2 = list.getText();
answer = Integer.parseInt(str2);
if(rand == answer)
list1.setText("\u606D\u559C\u4F60\uFF0C\u731C\u5BF9\u4E86\uFF01");
else
if(rand != answer)
list1.setText("\u5F88\u9057\u61BE\uFF0C\u731C\u9519\u4E86\uFF01");
}
void buttonAction4(ActionEvent event)
{
String str2 = list.getText();
answer = Integer.parseInt(str2);
if(rand > answer)
list2.setText("\u4F60\u731C\u7684\u6570\u5C0F\u4E86\u70B9\uFF01");
else
if(rand < answer)
list2.setText("\u4F60\u731C\u7684\u6570\u5927\u4E86\u70B9\uFF01");
}
void buttonAction5(ActionEvent event)
{
list3.setText((new StringBuilder()).append("\u7B54\u6848\u5176\u5B9E\u662F").append(rand).toString());
}
JTextField list1;
JTextField list2;
JTextField list3;
JButton button5;
JTextField list;
JButton button1;
JButton button2;
JButton button3;
JButton button4;
int rand;
int answer;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -