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


Java Form.showBack方法代码示例

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


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

示例1: back

import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
 * This method effectively pops the form navigation stack and goes back
 * to the previous form if back navigation is enabled and there is
 * a previous form.
 *
 * @param sourceComponent the component that triggered the back command which effectively
 * allows us to find the EmbeddedContainer for a case of container navigation. Null
 * can be used if not applicable.
 */
public void back(Component sourceComponent) {
    Vector formNavigationStack = getFormNavigationStackForComponent(sourceComponent);
    if(formNavigationStack != null && formNavigationStack.size() > 0) {
        Hashtable h = (Hashtable)formNavigationStack.elementAt(formNavigationStack.size() - 1);
        if(h.containsKey(FORM_STATE_KEY_CONTAINER)) {
            Form currentForm = Display.getInstance().getCurrent();
            if(currentForm != null) {
                exitForm(currentForm);
            }
        }
        String formName = (String)h.get(FORM_STATE_KEY_NAME);
        if(!h.containsKey(FORM_STATE_KEY_CONTAINER)) {
            Form f = (Form)createContainer(fetchResourceFile(), formName);
            initBackForm(f);
            onBackNavigation();
            beforeShow(f);
            f.showBack();
            postShowImpl(f);
        } else {
            showContainerImpl(formName, null, sourceComponent, true);
        }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:33,代码来源:UIBuilder.java

示例2: 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

示例3: UserForm

import com.codename1.ui.Form; //导入方法依赖的package包/类
public UserForm(String name, EncodedImage placeHolder, String imageURL) {
    this.name = name;
    this.imageURL = imageURL;
    setTitle("Welcome!");
    setLayout(new BorderLayout());
    
    Label icon = new Label(placeHolder);
    icon.setUIID("Picture");
    if(imageURL != null){
        icon.setIcon(URLImage.createToStorage(placeHolder, name, imageURL, null));
    }
    addComponent(BorderLayout.CENTER, icon);
    Label nameLbl = new Label(name);
    nameLbl.setUIID("Name");
    addComponent(BorderLayout.SOUTH, nameLbl);
    final Form current = Display.getInstance().getCurrent();
    Command back = new Command("Back"){

        @Override
        public void actionPerformed(ActionEvent evt) {
            current.showBack();;
        }

    };
    addCommand(back);
    setBackCommand(back);
    
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:29,代码来源:UserForm.java


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