UiScreen.java
资源名称:src.zip [点击查看]
上传用户:luxiaowei
上传日期:2022-06-06
资源大小:58k
文件大小:1k
源码类别:
J2ME
开发平台:
Java
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.framework;
- /**
- *
- * @author swaroop_kumar
- */
- public class UiScreen extends UiDisplayble{
- ScrollableContainer container;
- protected TitleBar titleBar;
- private SoftkeyBar softkeybar;
- public UiScreen() {
- container = new ScrollableContainer();
- container.setWidth(DisplayManager.getInst().getWidth());
- titleBar = getTitleBar();
- softkeybar = getSoftkeybar();
- softkeybar.invalidate();
- titleBar.invalidate();
- invalidate();
- }
- public SoftkeyBar getSoftkeybar() {
- if(softkeybar == null)
- {
- softkeybar = new SoftkeyBar(this);
- }
- return softkeybar;
- }
- public TitleBar getTitleBar() {
- if(titleBar == null)
- {
- titleBar = new TitleBar(this);
- }
- return titleBar;
- }
- public ScrollableContainer getBody() {
- return container;
- }
- public void invalidate()
- {
- getBody().setPosition(0, getTitleBar().getHeight());
- getBody().setHeight(DisplayManager.getInst().getHeight() - getTitleBar().getHeight() - getSoftkeybar().getHeight() );
- DisplayManager.getInst().invalidate();
- }
- public UIControl getSelectedChild()
- {
- UIControl control = container;
- while(control != null && control instanceof ScrollableContainer )
- {
- control = ((ScrollableContainer)control).getSelectedChild();
- }
- return control;
- }
- }