📄 component.java
字号:
package com.cuit.lui;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Graphics;
public abstract class Component {
protected boolean isOnFocus = false;
protected boolean isBorder = false;
protected Command cmd = null;
protected CommandListener cmdListener = null;
protected boolean ifCommand = true;
protected boolean needRepaint = true;
protected int posx, posy;
protected int width, height;
public Component() {
}
public abstract void paint(Graphics g);
public abstract int getWidth();
public abstract int getHeight();
public abstract void adjustLayout();
public abstract int getFocusy();
public abstract void reset();
public int getPosx() {
return posx;
}
public int getPosy() {
return posy;
}
public void setPosx(int x) {
posx = x;
}
public void setPosy(int y) {
posy = y;
}
public abstract boolean keyEvent(int keyCode);
public void generateEvent() {
if (cmd != null && cmdListener != null) {
cmdListener.commandAction(cmd, this);
needRepaint = true;
return;
} else {
System.out.println("command or listener null");
LScreen.warning("command or listener null");
}
}
public void setOnFocus(boolean b) {
isOnFocus = b;
}
public boolean getOnFocus() {
return isOnFocus;
}
public void setBorder(boolean b) {
isBorder = b;
}
public boolean getBorder() {
return isBorder;
}
public Command getCommand() {
return cmd;
}
public void reverse() {
isOnFocus = !isOnFocus;
}
public void addCommand(Command c) {
cmd = c;
ifCommand = true;
}
public void setCommandListener(CommandListener cl) {
cmdListener = cl;
}
public boolean ifCommand() {
return ifCommand;
}
public void setCommand(Command c) {
if (c != null)
cmd = c;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -