pop-up screen cho phép pop up 1 cửa sổ thông tin đơn giản ngắn gọn như about, info...




Mã:
/*
* aboutscreen.java
*
* © viet hop software, 2012
* confidential and proprietary.
*
* developer: aric
* email: sd@viethop.net
*/
 
import net.rim.device.api.system.characters;
import net.rim.device.api.ui.component.labelfield;
import net.rim.device.api.ui.component.separatorfield;
import net.rim.device.api.ui.container.popupscreen;
import net.rim.device.api.ui.container.verticalfieldmanager;
import net.rim.device.api.system.applicationdescriptor;
 
/**
* popupscreen that displays information about the application
*/
 
 
final class aboutscreen extends popupscreen
{
    /**
    * constructor.
    */
    aboutscreen()
    {
        super(new verticalfieldmanager());
      super(new horizontalfieldmanager(no_vertical_scroll));
        applicationdescriptor appdesc = applicationdescriptor.currentapplicationdescriptor();
   
bitmapfield bitmap = new bitmapfield(appdesc.geticon(), field_vcenter);
bitmap.setmargin(5, 5, 5, 5);
add(bitmap);
 
        verticalfieldmanager vfm = new verticalfieldmanager();
 
        vfm.add(new labelfield(appdesc.getname() + " - ver. " + appdesc.getversion()));
 
        vfm.add(new separatorfield());
        vfm.add(new labelfield("sd@viethop.net
viet hop software © 2012"));
    }
 
 
    /**
    * overrides the default.  closes the popup screen when the escape key is pressed.
    *
    * @see net.rim.device.api.ui.screen#keychar(char,int,int)
    */
    public boolean keychar(char c, int status, int time)
    {
        if (c == characters.escape)  // đóng cửa sổ khi người dùng nhấn escape.
        {
            close();
            return true;
        }
   
        return super.keychar(c, status, time);
    }
}


[img]http://www.**********************/attachments/9930-png.3154/[/img]

hình 1: minh họa pop-up screen​