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


Java Form.getToolbar方法代码示例

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


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

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

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

示例3: getToolbarCommands

import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
 * Returns all the command objects from the toolbar in the order of left, right, overflow & sidemenu
 * @return the set of commands
 */
public static Command[] getToolbarCommands() {
    Form f = Display.getInstance().getCurrent();
    Toolbar tb = f.getToolbar();
    ArrayList<Command> result = new ArrayList<Command>();
    addAllCommands(tb.getLeftBarCommands(), result);
    addAllCommands(tb.getRightBarCommands(), result);
    addAllCommands(tb.getOverflowCommands(), result);
    addAllCommands(tb.getSideMenuCommands(), result);
    Command[] carr = new Command[result.size()];
    result.toArray(carr);
    return carr;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:17,代码来源:TestUtils.java

示例4: showSidemenu

import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
 * Shows the sidemenu UI
 */
public static void showSidemenu() {
    Form f = Display.getInstance().getCurrent();
    Toolbar tb = f.getToolbar();
    if(tb != null) {
        tb.openSideMenu();
    } else {
        ((SideMenuBar)f.getMenuBar()).openMenu(null);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:13,代码来源:TestUtils.java

示例5: getFormTitle

import com.codename1.ui.Form; //导入方法依赖的package包/类
private static String getFormTitle(Form f) {
    if(f.getToolbar() != null) {
        Component c = f.getToolbar().getTitleComponent();
        if(c instanceof Label) {
            return ((Label)c).getText();
        }
        return null;
    } else {
        return f.getTitle();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:12,代码来源:TestUtils.java


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