当前位置: 首页>>代码示例>>Java>>正文


Java Form.setBackCommand方法代码示例

本文整理汇总了Java中com.codename1.ui.Form.setBackCommand方法的典型用法代码示例。如果您正苦于以下问题:Java Form.setBackCommand方法的具体用法?Java Form.setBackCommand怎么用?Java Form.setBackCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.codename1.ui.Form的用法示例。


在下文中一共展示了Form.setBackCommand方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addBackCommand

import com.codename1.ui.Form; //导入方法依赖的package包/类
public void addBackCommand(Form f)
{
    Image icon = StateMachine.getResourceFile().getImage("back_static.png");
    icon.lock();
    Image iconPressed = StateMachine.getResourceFile().getImage("back_active.png");
    iconPressed.lock();

    Command backCommand = new Command(null, icon){
        @Override
        public void actionPerformed(ActionEvent ev) {
            ui.back();
        }
    };
    backCommand.setPressedIcon(iconPressed);
    f.setBackCommand(backCommand);
}
 
开发者ID:martijn00,项目名称:MusicPlayerCodenameOne,代码行数:17,代码来源:SideMenu.java

示例2: showMainForm

import com.codename1.ui.Form; //导入方法依赖的package包/类
private void showMainForm() {
    final Form photos = new Form("Photos");
    photos.setLayout(new BorderLayout());
    GridLayout gr = new GridLayout(1, 1);
    final Container grid = new Container(gr);
    gr.setAutoFit(true);
    grid.setScrollableY(true);
    grid.addPullToRefresh(new Runnable() {
        public void run() {
            refreshGrid(grid);
        }
    });

    grid.addComponent(new InfiniteProgress());
    photos.addComponent(BorderLayout.CENTER, grid);

    photos.removeAllCommands();
    photos.setBackCommand(null);
    photos.addCommand(createPictureCommand(grid));

    photos.show();
    refreshGrid(grid);
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:24,代码来源:PhotoShare.java

示例3: showAuthentication

import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
 * This method shows an authentication for login form
 *
 * @param al a listener that will receive at its source either a token for
 * the service or an exception in case of a failure
 * @return a component that should be displayed to the user in order to
 * perform the authentication
 */
public void showAuthentication(ActionListener al) {
    final Form old = Display.getInstance().getCurrent();
    InfiniteProgress inf = new InfiniteProgress();
    final Dialog progress = inf.showInifiniteBlocking();
    Form authenticationForm = new Form("Login");
    authenticationForm.setScrollable(false);
    if (old != null) {
        Command cancel = new Command("Cancel") {
            public void actionPerformed(ActionEvent ev) {
                if (Display.getInstance().getCurrent() == progress) {
                    progress.dispose();
                }
                old.showBack();
            }
        };
        if (authenticationForm.getToolbar() != null){
            authenticationForm.getToolbar().addCommandToLeftBar(cancel);
        } else {
            authenticationForm.addCommand(cancel);
        }
        authenticationForm.setBackCommand(cancel);
    }
    authenticationForm.setLayout(new BorderLayout());
    authenticationForm.addComponent(BorderLayout.CENTER, createLoginComponent(al, authenticationForm, old, progress));
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:34,代码来源:Oauth2.java

示例4: showLog

import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
 * Places a form with the log as a TextArea on the screen, this method can
 * be attached to appear at a given time or using a fixed global key. Using
 * this method might cause a problem with further log output
 * @deprecated this method is an outdated method that's no longer supported
 */
public static void showLog() {
    try {
        String text = getLogContent();
        TextArea area = new TextArea(text, 5, 20);
        Form f = new Form("Log");
        f.setScrollable(false);
        final Form current = Display.getInstance().getCurrent();
        Command back = new Command("Back") {
            public void actionPerformed(ActionEvent ev) {
                current.show();
            }
        };
        f.addCommand(back);
        f.setBackCommand(back);
        f.setLayout(new BorderLayout());
        f.addComponent(BorderLayout.CENTER, area);
        f.show();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:28,代码来源:Log.java

示例5: addBackToHome

import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
 * Helper method to implement the back command to the main form
 * @param f the form from which we would be returning
 */
private void addBackToHome(Form f) {
    // the back command maps to the physical button on devices other than iPhone and creates the back arrow appearance on iOS
    f.setBackCommand(new Command("PropertyCross") {
        @Override
        public void actionPerformed(ActionEvent evt) {
            showMainForm(true, null, null);
        }
    });
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:14,代码来源:PropertyCross.java

示例6: createBackCommand

import com.codename1.ui.Form; //导入方法依赖的package包/类
Command createBackCommand(final Container viewerParent, final Container grid) {
    return new Command("Back") {
            @Override
            public void actionPerformed(ActionEvent evt) {
                viewerParent.getParent().replace(viewerParent, grid, CommonTransitions.createSlide(CommonTransitions.SLIDE_HORIZONTAL, true, 300));
                Form frm = Display.getInstance().getCurrent();
                frm.setBackCommand(null);
            }
        };
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:11,代码来源:PhotoShare.java

示例7: showMeOnMap

import com.codename1.ui.Form; //导入方法依赖的package包/类
private void showMeOnMap() {
    Form map = new Form("Map");
    map.setLayout(new BorderLayout());
    map.setScrollable(false);
    final MapComponent mc = new MapComponent();

    putMeOnMap(mc);
    mc.zoomToLayers();

    map.addComponent(BorderLayout.CENTER, mc);
    map.getToolbar().addCommandToLeftBar(new MapsDemo.BackCommand());
    map.setBackCommand(new MapsDemo.BackCommand());
    map.show();

}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:16,代码来源:MapsDemo.java

示例8: setBackCommand

import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
 * Invoked internally to set the back command on the form, this method allows subclasses
 * to change the behavior of back command adding or disable it
 * @param f the form
 * @param backCommand the back command 
 */
protected void setBackCommand(Form f, Command backCommand) {
    if(f.getToolbar() != null) {
        f.getToolbar().setBackCommand(backCommand);
    } else {
        if(shouldAddBackCommandToMenu()) {
            f.addCommand(backCommand, f.getCommandCount());
        }
        f.setBackCommand(backCommand);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:17,代码来源:UIBuilder.java


注:本文中的com.codename1.ui.Form.setBackCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。