Repository navigation
Expand file tree
/
Copy pathwilfred.java
More file actions
153 lines (123 loc) · 3.32 KB
/
Copy pathwilfred.java
File metadata and controls
153 lines (123 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mobileproject1;
/**
* @author sirus
*/
import java.io.IOException;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class wilfred extends MIDlet implements CommandListener{
Display myDisplay;
Form f1[];
Image im1[];
ImageItem i1[];
Ticker tkr1;
Command exit,c11,c21,c22,c31,c32,back;
String s;
StringItem name[],size[],date[],loc[];
int XxX=0;
public wilfred()
{
tkr1=new Ticker("W E L C O M E__TO__P H O T O__G A L L E R Y");
f1 = new Form[6];
im1=new Image[6];
i1=new ImageItem[6];
name=new StringItem[6];
date=new StringItem[6];
size=new StringItem[6];
loc=new StringItem[6];
name[0]=new StringItem("NAME: ","Rainbow apple");
name[1]=new StringItem("NAME: ","ninja Boy");
name[2]=new StringItem("NAME: ","Wallpaper");
name[3]=new StringItem("NAME: ","Wallpaper");
name[4]=new StringItem("NAME: ","Smile Face");
name[5]=new StringItem("NAME: ","Water Drop Face");
date[0]=new StringItem("DATE: ","1/2/2014");
date[1]=new StringItem("DATE: ","13/3/2014");
date[2]=new StringItem("DATE: ","26/4/2013");
date[3]=new StringItem("DATE: ","19/1/2012");
date[4]=new StringItem("DATE: ","7/8/2006");
date[5]=new StringItem("DATE: ","12/4/2001");
size[0]=new StringItem("SIZE: ","20kb");
size[1]=new StringItem("SIZE: ","30kb");
size[2]=new StringItem("SIZE: ","40kb");
size[3]=new StringItem("SIZE: ","10kb");
size[4]=new StringItem("SIZE: ","15kb");
size[5]=new StringItem("SIZE: ","21kb");
loc[0]=new StringItem("LOCATION: ","sdcard:/pictures");
loc[1]=new StringItem("LOCATION: ","sdcard:/Received files");
loc[2]=new StringItem("LOCATION: ","sdcard:/images");
loc[3]=new StringItem("LOCATION: ","sdcard:/pics");
loc[4]=new StringItem("LOCATION: ","sdcard:/movie");
loc[5]=new StringItem("LOCATION: ","sdcard:/music");
c11=new Command("NEXT",Command.SCREEN,1);
exit=new Command("EXIT",Command.EXIT,0);
back=new Command("BACK",Command.SCREEN,1);
try {
for(int i=0;i<6;i++)
{
s="/"+i+".png";
System.out.println("path="+s);
im1[i]=Image.createImage(s);
i1[i]=new ImageItem("",im1[i],ImageItem.LAYOUT_LEFT,null);
f1[i]=new Form("");
f1[i].append(i1[i]);
f1[i].append(name[i]);
f1[i].append(date[i]);
f1[i].append(size[i]);
f1[i].append(loc[i]);
f1[i].setTicker(tkr1);
f1[i].addCommand(c11);
f1[i].addCommand(exit);
f1[i].addCommand(back);
f1[i].setCommandListener(this);
}
} catch (Exception ex)
{
System.out.println("E R R O R = "+ex);
}
}
public void startApp() {
myDisplay = Display.getDisplay(this);
myDisplay.setCurrent(f1[XxX]);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable dsplbl) {
if(c==c11)
{
XxX++;
System.out.println("XxX="+XxX);
if(XxX<6)
{
myDisplay.setCurrent(f1[XxX]);
}
else
{
XxX--;
}
}
else if(c==exit)
{
notifyDestroyed();
}
if(c==back)
{
XxX--;
if(XxX>=0)
{
myDisplay.setCurrent(f1[XxX]);
}
else
{
XxX++;
}
}
}
}