`
weimou66
  • 浏览: 1245787 次
文章分类
社区版块
存档分类
最新评论

黑莓手机开发开发tips: 给MainScreen加菜单Menu

 
阅读更多

如下代码中,实现makeMenu()方法给EclScreen窗口加菜单。

public class EclScreen extends MainScreen
{
RichTextField textField;

public EclScreen()
{
setTitle("Pushed Data Listener");
LabelField label = new LabelField("Pushed Data:");
add(label);

textField = new RichTextField();
add(textField);

}

/******************************************************************************************
* makeMenu(Menu,int) - creates a custom menu to add user define fields
******************************************************************************************/
protected void makeMenu(Menu menu, int instance)
{

MenuItem optionMenu = new MenuItem("Option", 100, 10) {
public void run() {
OptionScreen screen = new OptionScreen();
UiApplication.getUiApplication().pushScreen(screen); //点击菜单Option将弹出新的窗口OptionScreen

}
};
menu.add(optionMenu);
}
}

分享到:
评论

相关推荐

    ios-酷炫重力感应imageView.zip

    YGGravityImageView *imageView = [[YGGravityImageView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)]; imageView.image = ...

    rubymotion-hybrid-sample:RubyMotion 混合(iOS + Android)应用程序示例

    这是一个简单的应用程序,在纯 Ruby 中实现如下: class MainScreen < Screen def on_load @label = Label . make ( 'Tap to start' ) @button = Button . make ( 'Start' , 'Stop' ) { timer_tap } self <&...

    flutter_zoom_drawer:Flutter套件,带有Drawer的自定义实现

    颤动缩放抽屉 Flutter套件,具有侧边菜单(抽屉)的自定义实现入门要开始使用此包, flutter_zoom_drawer在您的pubspec.yaml添加flutter_zoom... DefaultStyle , menuScreen : MENU_SCREEN , mainScreen : MAIN_SCREEN

    ios-两行代码快速创建一个iOS主流UI框架.zip

    self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds]; MainController *mainVc = [[MainController alloc]init]; // 设置根控制器 self.window.rootViewController = mainVc; ...

    并行对象缓存TMCache.zip

    TMCache 是 Tumblr 公司开发的一个快速,无死锁的并行对象缓存,支持 iOS 和 OS X 系统。示例代码:UIImage *img = [[UIImage alloc] initWithData:data scale:[[UIScreen mainScreen] scale]];[[PINCache ...

    并行对象缓存PINCache.zip

    PINCache 是 Pinterest 公司开发的一个快速,无死锁的并行对象缓存,支持 iOS 和 OS X 系统, 是 TMCache 的改进版本。示例代码:UIImage *img = [[UIImage alloc] initWithData:data scale:[[UIScreen mainScreen] ...

    ios开发记录

    //此方法可以有参数,也可以没有参数,如果没有参数系统不会给你穿参数,如果有参数,只能有一个参数,无论你所指定的参数类型是什么,系统只会把tf本身给传过去 [tf addTarget:self action:@selector(down:) ...

    animated_splash_screen:以完全可自定义的方式创建动画启动画面的最简单方法

    如果您能帮助我振作起来,给我喝杯咖啡会让我的生活真正幸福,并从中获得很多能量。入门使用起来很简单,只需执行以下操作: @override Widget build(BuildContext context) { return AnimatedSplashScreen( splash...

    iOS实现屏幕亮度和闪光灯控制的实例代码

    读取屏幕亮度:[UIScreen mainScreen].brightness; 设置屏幕亮度:[[UIScreen mainScreen] setBrightness:0.5]; 获取环境亮度主要代码: - (void)getTorch { AVCaptureDevice *device = [AVCaptureDevice ...

    模仿新浪微博弹出菜单

    y = CGRectGetHeight([UIScreen mainScreen].bounds)/2 * 0.3f; w = 213; h = 57; //自定义的头部视图 UIImageView *topView = [[ImageView alloc] initWithFrame:CGRectMake(x, y, w, h)]; topView.image = ...

    XXBAutoPagView:自动分页的ScrollView

    XXBAutoPagView *autoPageView = [[XXBAutoPagView alloc] initWithFrame:[UIScreen mainScreen].bounds]; [self.view addSubview:autoPageView]; // 设置数据源和代理 autoPageView.dataSource = self; ...

    GskSliderView:一个侧滑的类,仿QQ侧滑,模糊化处理

    (NSDictionary *)launchOptions { self.window =[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds]; self.window.backgroundColor =[UIColor whiteColor]; ViewController *vc = [[ViewController ...

    ios-BSYAlertView.zip

    bsy = [[bsy_Window alloc]initWithFrame:[UIScreen mainScreen].bounds]; [bsy addBsy_quitBtnMessage:@"取消" sureMessage:@"确定" message:@"Do any additional setup after loading the view, typically from ...

    iOS开发中UITabBarController的使用示例

    首先我们看一下它的view层级图: ... self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];   // Override point for customization after application launch.   se

    CPMotionRecognizer:向 UIResponder 添加“动作识别器”(用于检测抖动)

    用法设置一次… 在您的应用程序委托中,实例化运动检测 UIWindow 子类: self.window = [[CPMotionRecognizingWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];...然后像这样使用无论你想要处理抖动的...

    ios-字体大小适配-runtime.zip

    runtime字体大小适配 (void)load{ //获取替换后的类方法 Method newMethod = class_... newFont = [UIFont adjustFont:fontSize * [UIScreen mainScreen].bounds.size.width/YourUIScreen]; return newFont; }

    支持卡片式的列表视图特效

    [UIScreen mainScreen].applicationFrame] autorelease]; view.delegate = self; view.dataSource = self; view.animationStyle = RSCardsViewAnimationStyleExchange; // or RSCardsViewAnimationStyleDrop ...

    ios-仿优酷视频,搜狐视频,凤凰新闻上导航滑动scrollview 以及绑定下面的viewcontroller.zip

    self.controllerScrollview = [ControllerScrollView.alloc initWithFrame:CGRectMake(0, self.topScrollview.frame.origin.y self.topScrollview.frame.size.height, [UIScreen mainScreen].bounds.size.width, ...

    ios - A-常用宏定义

    #define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width) #define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height) //-------------------获取设备大小----判断5--------------------- #define...

    ios-IOS下拉菜单.zip

    menuFrame:CGRectMake([UIScreen mainScreen].bounds.size.width-125- 10, 136, 125, 115) clickIndexHandle:^(NSInteger index) { switch (index) { case 0://这个是选中哪一行的时候的输出,或者执行的动作,...

Global site tag (gtag.js) - Google Analytics