UiAlert.java
资源名称:src.zip [点击查看]
上传用户:luxiaowei
上传日期:2022-06-06
资源大小:58k
文件大小:2k
源码类别:
J2ME
开发平台:
Java
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.framework;
- import javax.microedition.lcdui.Graphics;
- /**
- *
- * @author Swaroop Kumar
- */
- public class UiAlert extends UiDisplayble{
- protected TitleBar titleBar;
- private SoftkeyBar softkeybar;
- ScrollableContainer container;
- TextControl textControl;
- public UiAlert(String text,GTantra font,int align) {
- container = new ScrollableContainer();
- container.setWidth(DisplayManager.getInst().getWidth());
- textControl = new TextControl(text, DisplayManager.getInst().getWidth(), font,align , false);
- if(textControl.getHeight() < DisplayManager.getInst().getHeight() >> 3)
- {
- textControl.setHeight(DisplayManager.getInst().getHeight() >> 3);
- }
- container.addChildren(textControl);
- titleBar = getTitleBar();
- softkeybar = getSoftkeybar();
- softkeybar.invalidate();
- titleBar.invalidate();
- invalidate();
- setTransitionEffect(TransitionEffect.TRANSITION_BOTTOM_TO_TOP);
- }
- public void invalidate() {
- getBody().setHeight(textControl.getHeight());
- getBody().setPosition(0, DisplayManager.getInst().getHeight() - getSoftkeybar().getHeight() - textControl.getHeight());
- getTitleBar().setY(getBody().getY() - getTitleBar().getHeight());
- DisplayManager.getInst().invalidate();
- }
- public SoftkeyBar getSoftkeybar() {
- if(softkeybar == null)
- {
- softkeybar = new SoftkeyBar(this);
- }
- return softkeybar;
- }
- public void paintUI(Graphics g) {
- super.paintUI(g);
- }
- public TitleBar getTitleBar() {
- if(titleBar == null)
- {
- titleBar = new TitleBar(this);
- }
- return titleBar;
- }
- public ScrollableContainer getBody() {
- return container;
- }
- }