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