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


Java Form.setScrollable方法代码示例

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


在下文中一共展示了Form.setScrollable方法的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: 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

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

示例4: showSplashScreen

import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
 * The splash screen is relatively bare bones. Its important to have a splash screen for iOS 
 * since the build process generates a screenshot of this screen to speed up perceived performance
 */
public void showSplashScreen() {
    final Form splash = new Form();
    
    // a border layout places components in the center and the 4 sides.
    // by default it scales the center component so here we configure
    // it to place the component in the actual center
    BorderLayout border = new BorderLayout();
    border.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
    splash.setLayout(border);
    
    // by default the form's content pane is scrollable on the Y axis
    // we need to disable it here
    splash.setScrollable(false);
    Label title = new Label("Poker Ace");
    
    // The UIID is used to determine the appearance of the component in the theme
    title.setUIID("SplashTitle");
    Label subtitle = new Label("By Codename One");
    subtitle.setUIID("SplashSubTitle");
    
    splash.addComponent(BorderLayout.NORTH, title);
    splash.addComponent(BorderLayout.SOUTH, subtitle);
    Label as = new Label(cards.getImage("as.png"));
    Label ah = new Label(cards.getImage("ah.png"));
    Label ac = new Label(cards.getImage("ac.png"));
    Label ad = new Label(cards.getImage("ad.png"));

    // a layered layout places components one on top of the other in the same dimension, it is
    // useful for transparency but in this case we are using it for an animation
    final Container center = new Container(new LayeredLayout());
    center.addComponent(as);
    center.addComponent(ah);
    center.addComponent(ac);
    center.addComponent(ad);
    
    splash.addComponent(BorderLayout.CENTER, center);
            
    splash.show();
    splash.setTransitionOutAnimator(CommonTransitions.createCover(CommonTransitions.SLIDE_VERTICAL, true, 800));

    // postpone the animation to the next cycle of the EDT to allow the UI to render fully once
    Display.getInstance().callSerially(new Runnable() {
        public void run() {
            // We replace the layout so the cards will be laid out in a line and animate the hierarchy
            // over 2 seconds, this effectively creates the effect of cards spreading out
            center.setLayout(new BoxLayout(BoxLayout.X_AXIS));
            center.setShouldCalcPreferredSize(true);
            splash.getContentPane().animateHierarchy(2000);

            // after showing the animation we wait for 2.5 seconds and then show the game with a nice
            // transition, notice that we use UI timer which is invoked on the Codename One EDT thread!
            new UITimer(new Runnable() {
                public void run() {
                    showGameUI();
                }
            }).schedule(2500, false, splash);
        }
    });
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:64,代码来源:Poker.java

示例5: showSplashAnimation

import com.codename1.ui.Form; //导入方法依赖的package包/类
private void showSplashAnimation() {
    Form splash = new Form();
    splash.setUIID("Splash");
    splash.getContentPane().setUIID("Container");
    splash.getTitleArea().setUIID("Container");
    BorderLayout border = new BorderLayout();
    border.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
    splash.setLayout(border);
    splash.setScrollable(false);
    Label title = new Label("Kitchen Sink Demo");
    title.setUIID("SplashTitle");
    Label subtitle = new Label("By Codename One");
    subtitle.setUIID("SplashSubTitle");
    splash.addComponent(BorderLayout.NORTH, title);
    splash.addComponent(BorderLayout.SOUTH, subtitle);
    Label beaker = new Label(res.getImage("beaker.png"));
    final Label beakerLogo = new Label(res.getImage("beaker_logo.png"));
    beakerLogo.setVisible(false);
    Container layeredLayout = new Container(new LayeredLayout());
    splash.addComponent(BorderLayout.CENTER, layeredLayout);
    layeredLayout.addComponent(beaker);
    final Container logoParent = new Container(new BorderLayout());
    layeredLayout.addComponent(logoParent);
    logoParent.addComponent(BorderLayout.CENTER, beakerLogo);
    splash.revalidate();
    
    Display.getInstance().callSerially(new Runnable() {
        public void run() {
            beakerLogo.setVisible(true);
            beakerLogo.setX(0);
            beakerLogo.setY(0);
            beakerLogo.setWidth(3);
            beakerLogo.setHeight(3);
            logoParent.setShouldCalcPreferredSize(true);
            logoParent.animateLayoutFade(2000, 0);
        }
    });
    
    splash.show();
    splash.setTransitionOutAnimator(CommonTransitions.createFastSlide(CommonTransitions.SLIDE_VERTICAL, true, 300));
    new UITimer(new Runnable() {
        public void run() {
            showMainUI();
        }
    }).schedule(2500, false, splash);
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:47,代码来源:KitchenSink.java


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