📄 compositecomponent.java
字号:
package prototype;
import java.util.Vector;
import javax.microedition.lcdui.Graphics;
public class CompositeComponent extends Component {
Vector childs = new Vector();
Component focus;
int rectX;
int rectY;
int rectW;
int rectH;
public CompositeComponent(int x, int y, int width, int height) {
super(x, y, width, height);
// TODO
}
public void add(Component c, int index) {
childs.insertElementAt(c, index);
c.setParent(this);
}
final public void add(Component c) {
this.add(c, childs.size());
}
/**
* Gets the number of components currently added
*
* @return the number of components currently added
*/
public int getComponentCount() {
return childs.size();
}
/**
* get UIComponet at the specified index
*
* @param index
* @return
*/
public Focusable getComponent(int index) {
return (Focusable) childs.elementAt(index);
}
public int getComponentIndex(Focusable c) {
return childs.indexOf(c);
}
public void remove(int index) {
((Component) childs.elementAt(index)).setParent(null);
childs.removeElementAt(index);
}
final public void setFocusNext() {
if (focus != null)
moveFocus(focus, true);
}
public Focusable getFocus() {
return focus;
}
void moveFocus(Focusable c, boolean forward) {
}
protected void paint(Graphics g, CompositeComponent w) {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -