📄 propertyform.java
字号:
import javax.microedition.lcdui.*;
import java.util.Date;
import java.util.Calendar;
public class PropertyForm extends Form implements CommandListener {
private FileManagerMIDlet midlet;
private StringItem siName;
private StringItem siReadable;
private StringItem siWriteable;
private StringItem siHidden;
private StringItem siModifyDate;
private Displayable backScreen;
private Command cmdBack = new Command("返回", Command.BACK, 1);
public PropertyForm(FileManagerMIDlet midlet) {
super("属性");
this.midlet = midlet;
siName = new StringItem("文件名:", "");
siReadable = new StringItem("可读:", "");
siWriteable = new StringItem("可写:", "");
siHidden = new StringItem("隐藏:", "");
siModifyDate = new StringItem("最后修改时间:", "");
append(siName);
append(siReadable);
append(siWriteable);
append(siHidden);
append(siModifyDate);
addCommand(cmdBack);
setCommandListener(this);
}
public void update(File f, Displayable backScreen) {
this.backScreen = backScreen;
siName.setText(f.getName());
if(f.canRead()) {
siReadable.setText("是");
}
else {
siReadable.setText("否");
}
if(f.canWrite()) {
siWriteable.setText("是");
}
else {
siWriteable.setText("否");
}
if(f.isHidden()) {
siHidden.setText("是");
}
else {
siHidden.setText("否");
}
long d = f.getLastModify();
Calendar cale = Calendar.getInstance();
cale.setTime(new Date(d));
String t = cale.get(Calendar.YEAR) + "年"
+ (cale.get(Calendar.MONTH) + 1) + "月"
+ cale.get(Calendar.DAY_OF_MONTH) + "日"
+ cale.get(Calendar.HOUR_OF_DAY) + "时"
+ cale.get(Calendar.MINUTE) + "分";
siModifyDate.setText(t);
}
public void commandAction(Command cmd, Displayable d) {
if(cmd == cmdBack) {
Display display = Display.getDisplay(midlet);
display.setCurrent(backScreen);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -