本文整理汇总了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));
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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();
}
}