📄 bjmidlet.java
字号:
import java.util.Date;
import java.util.Random;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class bjmidlet extends MIDlet
implements CommandListener
{
private Display display;
public List l;
public List l1;
private Ticker ticker;
private Command command1;
private Command command2;
private Command command3;
private Command command4;
private Command command5;
private Command command6;
private Command queding;
private Command quxiao;
private Command comkaishi;
private String che;
private String pin;
private String jiu;
private String kan;
private String ji;
private String jiali;
private String txts;
private String shujuku;
public static int ches;
public static int pins;
public static int jius;
public static int kans;
public static int jis;
public static int tis;
public int flag;
public int flag1;
public int jiaoyis;
public int kucun;
public Form form1;
public Form formks;
private TextField text1;
private static Random rand;
public long seed;
public long xj;
public long x1;
public long x2;
public long x3;
public long x4;
public long x5;
private Image image1;
private Image image2;
private Image image3;
private Image image4;
private Image image5;
private Image imageks;
private Image imagej1;
private Image imagej2;
private Image imagej3;
private Image imagej4;
private Image imagej5;
private Image imagej6;
public bjmidlet()
{
flag = 0;
flag1 = 0;
ches = 0;
pins = 0;
jius = 0;
kans = 0;
jis = 0;
tis = 1;
xj = 2000L;
kucun = 0;
l = new List("黑市价格表" + tis + "/40天", 3);
l1 = new List("选择", 3);
rand = new Random((new Date()).getTime());
jiali = "北京是中华人民共和国的首都,有着悠久的文化历史和良好的社会环境。我家里现在有" + xj + "现金" + ches + "台走私汽车" + pins + "假冒化妆品" + jius + "瓶假白酒" + kans + "本色情书刊" + jis + "台水货手机";
shujuku = "现金 " + xj + "\n汽车 " + ches + "\n化妆品 " + pins + "\n白酒 " + jius + "\n书刊 " + kans + "\n手机 " + jis + "\n库存 " + kucun + "/100";
text1 = new TextField("请输入数量", "", 2, 2);
ticker = new Ticker(jiali);
try
{
image1 = Image.createImage("/chetu.png");
image2 = Image.createImage("/huatu.png");
image3 = Image.createImage("/jiutu.png");
image4 = Image.createImage("/kantu.png");
image5 = Image.createImage("/jitu.png");
imageks = Image.createImage("/kaishi.png");
imagej1 = Image.createImage("/jiewei1.png");
imagej2 = Image.createImage("/jiewei2.png");
imagej3 = Image.createImage("/jiewei3.png");
imagej4 = Image.createImage("/jiewei4.png");
imagej5 = Image.createImage("/jiewei5.png");
imagej6 = Image.createImage("/jiewei6.png");
}
catch(Exception exception) { }
form1 = new Form("俺要弄多少呢?");
formks = new Form("北京浮生记");
command1 = new Command("北京站", 4, 1);
command2 = new Command("建国门", 4, 1);
command3 = new Command("东直门", 4, 1);
command4 = new Command("西直门", 4, 1);
command5 = new Command("复兴门", 4, 1);
comkaishi = new Command("开始", 4, 0);
do
x1 = rand.nextLong() % 30000L;
while(x1 <= 15000L);
che = "走私汽车 " + x1;
do
x2 = rand.nextInt() % 300;
while(x2 <= 50L);
pin = "假冒化妆品 " + x2;
do
x3 = rand.nextInt() % 3500;
while(x3 <= 1000L);
jiu = "假白酒 " + x3;
do
x4 = rand.nextInt() % 15000;
while(x4 <= 5000L);
kan = "淫荡少女 " + x4;
do
x5 = rand.nextInt() % 2500;
while(x5 <= 600L);
ji = "水货手机 " + x5;
l.append(che, image1);
l.append(pin, image2);
l.append(jiu, image3);
l.append(kan, image4);
l.append(ji, image5);
queding = new Command("确定", 4, 1);
quxiao = new Command("取消", 3, 2);
formks.append(imageks);
formks.addCommand(comkaishi);
}
public void startApp()
{
display = Display.getDisplay(this);
l.setCommandListener(this);
l1.setCommandListener(this);
form1.setCommandListener(this);
formks.setCommandListener(this);
form1.append(text1);
form1.append(shujuku);
form1.setTicker(ticker);
form1.addCommand(queding);
form1.addCommand(quxiao);
l1.append("购买", null);
l1.append("卖出", null);
l.setTicker(ticker);
l.addCommand(command1);
l.addCommand(command2);
l.addCommand(command3);
l.addCommand(command4);
l.addCommand(command5);
display.setCurrent(formks);
}
public void pauseApp()
{
}
public void destroyApp(boolean flag2)
{
}
public void csdestroy()
{
flag = 0;
flag1 = 0;
ches = 0;
pins = 0;
jius = 0;
kans = 0;
jis = 0;
tis = 1;
xj = 2000L;
kucun = 0;
jiali = "北京是中华人民共和国的首都,有着悠久的文化历史和良好的社会环境。我家里现在有" + xj + "现金" + ches + "台走私汽车" + pins + "假冒化妆品" + jius + "瓶假白酒" + kans + "本色情书刊" + jis + "台水货手机";
shujuku = "现金 " + xj + "\n汽车 " + ches + "\n化妆品 " + pins + "\n白酒 " + jius + "\n书刊 " + kans + "\n手机 " + jis + "\n库存 " + kucun + "/100";
ticker.setString(jiali);
}
public void commandAction(Command command, Displayable displayable)
{
Alert alert = new Alert("错误", "输入数量有错误", null, AlertType.ERROR);
alert.setTimeout(-2);
if(command == comkaishi)
display.setCurrent(l);
else
if(command == queding)
{
txts = text1.getString();
int i = txts.length();
text1.setString("");
alert.setTitle("错误");
if(i != 0)
jiaoyis = Integer.parseInt(txts);
else
jiaoyis = 0;
if(flag1 == 0 && kucun + jiaoyis <= 100)
{
if(flag == 0 && xj - (long)jiaoyis * x1 >= 0L)
{
xj = xj - (long)jiaoyis * x1;
ches += jiaoyis;
kucun = ches + pins + jius + kans + jis;
jiali = "我家里现在有" + xj + "现金" + ches + "台走私汽车" + pins + "假冒化妆品" + jius + "瓶假白酒" + kans + "本色情书刊" + jis + "台水货手机";
shujuku = "现金 " + xj + "\n汽车 " + ches + "\n化妆品 " + pins + "\n白酒 " + jius + "\n书刊 " + kans + "\n手机 " + jis + "\n库存 " + kucun + "/100";
form1.delete(1);
form1.append(shujuku);
ticker.setString(jiali);
display.setCurrent(l);
} else
if(flag == 1 && xj - (long)jiaoyis * x2 >= 0L)
{
xj = xj - (long)jiaoyis * x2;
pins += jiaoyis;
kucun = ches + pins + jius + kans + jis;
jiali = "我家里现在有" + xj + "现金" + ches + "台走私汽车" + pins + "假冒化妆品" + jius + "瓶假白酒" + kans + "本色情书刊" + jis + "台水货手机";
shujuku = "现金 " + xj + "\n汽车 " + ches + "\n化妆品 " + pins + "\n白酒 " + jius + "\n书刊 " + kans + "\n手机 " + jis + "\n库存 " + kucun + "/100";
form1.delete(1);
form1.append(shujuku);
ticker.setString(jiali);
display.setCurrent(l);
} else
if(flag == 2 && xj - (long)jiaoyis * x3 >= 0L)
{
xj = xj - (long)jiaoyis * x3;
jius += jiaoyis;
kucun = ches + pins + jius + kans + jis;
jiali = "我家里现在有" + xj + "现金" + ches + "台走私汽车" + pins + "假冒化妆品" + jius + "瓶假白酒" + kans + "本色情书刊" + jis + "台水货手机";
shujuku = "现金 " + xj + "\n汽车 " + ches + "\n化妆品 " + pins + "\n白酒 " + jius + "\n书刊 " + kans + "\n手机 " + jis + "\n库存 " + kucun + "/100";
form1.delete(1);
form1.append(shujuku);
ticker.setString(jiali);
display.setCurrent(l);
} else
if(flag == 3 && xj - (long)jiaoyis * x4 >= 0L)
{
xj = xj - (long)jiaoyis * x4;
kans += jiaoyis;
kucun = ches + pins + jius + kans + jis;
jiali = "我家里现在有" + xj + "现金" + ches + "台走私汽车" + pins + "假冒化妆品" + jius + "瓶假白酒" + kans + "本色情书刊" + jis + "台水货手机";
shujuku = "现金 " + xj + "\n汽车 " + ches + "\n化妆品 " + pins + "\n白酒 " + jius + "\n书刊 " + kans + "\n手机 " + jis + "\n库存 " + kucun + "/100";
form1.delete(1);
form1.append(shujuku);
ticker.setString(jiali);
display.setCurrent(l);
} else
if(flag == 4 && xj - (long)jiaoyis * x5 >= 0L)
{
xj = xj - (long)jiaoyis * x5;
jis += jiaoyis;
kucun = ches + pins + jius + kans + jis;
jiali = "我家里现在有" + xj + "现金" + ches + "台走私汽车" + pins + "假冒化妆品" + jius + "瓶假白酒" + kans + "本色情书刊" + jis + "台水货手机";
shujuku = "现金 " + xj + "\n汽车 " + ches + "\n化妆品 " + pins + "\n白酒 " + jius + "\n书刊 " + kans + "\n手机 " + jis + "\n库存 " + kucun + "/100";
form1.delete(1);
form1.append(shujuku);
ticker.setString(jiali);
display.setCurrent(l);
} else
{
jiali = "我家里现在有" + xj + "现金" + ches + "台走私汽车" + pins + "假冒化妆品" + jius + "瓶假白酒" + kans + "本色情书刊" + jis + "台水货手机";
shujuku = "现金 " + xj + "\n汽车 " + ches + "\n化妆品 " + pins + "\n白酒 " + jius + "\n书刊 " + kans + "\n手机 " + jis + "\n库存 " + kucun + "/100";
form1.delete(1);
form1.append(shujuku);
ticker.setString(jiali);
alert.setString("俺的钱不够买这么多东西还是俺家没有地方了?");
display.setCurrent(alert, form1);
}
} else
if(flag1 == 1)
if(flag == 0 && ches - jiaoyis >= 0)
{
xj = xj + (long)jiaoyis * x1;
ches -= jiaoyis;
kucun = ches + pins + jius + kans + jis;
jiali = "我家里现在有" + xj + "现金" + ches + "台走私汽车" + pins + "假冒化妆品" + jius + "瓶假白酒" + kans + "本色情书刊" + jis + "台水货手机";
shujuku = "现金 " + xj + "\n汽车 " + ches + "\n化妆品 " + pins + "\n白酒 " + jius + "\n书刊 " + kans + "\n手机 " + jis + "\n库存 " + kucun + "/100";
form1.delete(1);
form1.append(shujuku);
ticker.setString(jiali);
display.setCurrent(l);
} else
if(flag == 1 && pins - jiaoyis >= 0)
{
xj = xj + (long)jiaoyis * x2;
pins -= jiaoyis;
kucun = ches + pins + jius + kans + jis;
jiali = "我家里现在有" + xj + "现金" + ches + "台走私汽车" + pins + "假冒化妆品" + jius + "瓶假白酒" + kans + "本色情书刊" + jis + "台水货手机";
shujuku = "现金 " + xj + "\n汽车 " + ches + "\n化妆品 " + pins + "\n白酒 " + jius + "\n书刊 " + kans + "\n手机 " + jis + "\n库存 " + kucun + "/100";
form1.delete(1);
form1.append(shujuku);
ticker.setString(jiali);
display.setCurrent(l);
} else
if(flag == 2 && jius - jiaoyis >= 0)
{
xj = xj + (long)jiaoyis * x3;
jius -= jiaoyis;
kucun = ches + pins + jius + kans + jis;
jiali = "我家里现在有" + xj + "现金" + ches + "台走私汽车" + pins + "假冒化妆品" + jius + "瓶假白酒" + kans + "本色情书刊" + jis + "台水货手机";
shujuku = "现金 " + xj + "\n汽车 " + ches + "\n化妆品 " + pins + "\n白酒 " + jius + "\n书刊 " + kans + "\n手机 " + jis + "\n库存 " + kucun + "/100";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -