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


Java Dialog.dispose方法代码示例

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


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

示例1: createDetailsButtonActionListener

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
ActionListener createDetailsButtonActionListener(final long imageId) {
    return new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                InfiniteProgress ip = new InfiniteProgress();
                Dialog dlg = ip.showInifiniteBlocking();
                try {
                    String[] data = WebServiceProxy.getPhotoDetails(imageId);
                    String s = "";
                    for(String d : data) {
                        s += d;
                        s += "\n";
                    }
                    dlg.dispose();
                    Dialog.show("Data", s, "OK", null);
                } catch(IOException err) {
                    dlg.dispose();
                    Dialog.show("Error", "Error connecting to server", "OK", null);
                }
            }
        };
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:22,代码来源:PhotoShare.java

示例2: showFacebookUser

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
private void showFacebookUser(String token){
    ConnectionRequest req = new ConnectionRequest();
    req.setPost(false);
    req.setUrl("https://graph.facebook.com/v2.3/me");
    req.addArgumentNoEncoding("access_token", token);
    InfiniteProgress ip = new InfiniteProgress();
    Dialog d = ip.showInifiniteBlocking();
    NetworkManager.getInstance().addToQueueAndWait(req);
    byte[] data = req.getResponseData();
    JSONParser parser = new JSONParser();
    Map map = null;
    try {
        map = parser.parseJSON(new InputStreamReader(new ByteArrayInputStream(data), "UTF-8"));
    } catch (IOException ex) {
        ex.printStackTrace();
    }
    String name = (String) map.get("name");
    d.dispose();
    Form userForm = new UserForm(name, (EncodedImage) theme.getImage("user.png"), "https://graph.facebook.com/v2.3/me/picture?access_token=" + token);
    userForm.show();
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:22,代码来源:SignIn.java

示例3: showGoogleUser

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
private void showGoogleUser(String token){
    ConnectionRequest req = new ConnectionRequest();
    req.addRequestHeader("Authorization", "Bearer " + token);
    req.setUrl("https://www.googleapis.com/plus/v1/people/me");
    req.setPost(false);
    InfiniteProgress ip = new InfiniteProgress();
    Dialog d = ip.showInifiniteBlocking();
    NetworkManager.getInstance().addToQueueAndWait(req);
    d.dispose();
    byte[] data = req.getResponseData();
    JSONParser parser = new JSONParser();
    Map map = null;
    try {
        map = parser.parseJSON(new InputStreamReader(new ByteArrayInputStream(data), "UTF-8"));
    } catch (IOException ex) {
        ex.printStackTrace();
    }
    String name = (String) map.get("displayName");
    Map im = (Map) map.get("image");
    String url = (String) im.get("url");
    Form userForm = new UserForm(name, (EncodedImage) theme.getImage("user.png"), url);
    userForm.show();
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:24,代码来源:SignIn.java

示例4: showAuthentication

import com.codename1.ui.Dialog; //导入方法依赖的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

示例5: captureAudio

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
public void captureAudio(ActionListener response) {
    String p = FileSystemStorage.getInstance().getAppHomePath();
    if(!p.endsWith("/")) {
        p += "/";
    }
    try {
        final Media media = MediaManager.createMediaRecorder(p + "cn1TempAudioFile", MediaManager.getAvailableRecordingMimeTypes()[0]);
        media.play();

        boolean b = Dialog.show("Recording", "", "Save", "Cancel");
        final Dialog d = new Dialog("Recording");

        media.pause();
        media.cleanup();
        d.dispose();
        if(b) {
            response.actionPerformed(new ActionEvent(p + "cn1TempAudioFile"));
        } else {
            FileSystemStorage.getInstance().delete(p + "cn1TempAudioFile");
            response.actionPerformed(null);
        }
    } catch(IOException err) {
        err.printStackTrace();
        response.actionPerformed(null);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:27,代码来源:IOSImplementation.java

示例6: showAuthentication

import com.codename1.ui.Dialog; //导入方法依赖的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();
            }
        };
        authenticationForm.addCommand(cancel);
        authenticationForm.setBackCommand(cancel);
    }
    authenticationForm.setLayout(new BorderLayout());
    authenticationForm.addComponent(BorderLayout.CENTER, createLoginComponent(al, authenticationForm, old, progress));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:28,代码来源:Oauth2.java

示例7: captureAudio

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
public void captureAudio(ActionListener response) {
    dropEvents = false;
    String p = FileSystemStorage.getInstance().getAppHomePath();
    if(!p.endsWith("/")) {
        p += "/";
    }
    try {
        final Media media = MediaManager.createMediaRecorder(p + "cn1TempAudioFile", MediaManager.getAvailableRecordingMimeTypes()[0]);
        media.play();

        boolean b = Dialog.show("Recording", "", "Save", "Cancel");
        final Dialog d = new Dialog("Recording");

        media.pause();
        media.cleanup();
        d.dispose();
        if(b) {
            response.actionPerformed(new ActionEvent(p + "cn1TempAudioFile"));
        } else {
            FileSystemStorage.getInstance().delete(p + "cn1TempAudioFile");
            response.actionPerformed(null);
        }
    } catch(IOException err) {
        err.printStackTrace();
        response.actionPerformed(null);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:28,代码来源:IOSImplementation.java

示例8: showWelcomeAd

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
/**
 * Invoked on application startup, this code will download an ad or timeout 
 */
public void showWelcomeAd() {
    if(!UIManager.getInstance().wasThemeInstalled()) {
        if(Display.getInstance().hasNativeTheme()) {
            Display.getInstance().installNativeTheme();
        }
    }
    ConnectionRequest r = createAdRequest();
    r.setPriority(ConnectionRequest.PRIORITY_HIGH);
    r.setTimeout(timeout);
    InfiniteProgress ip = new InfiniteProgress();
    Dialog ipDialog = ip.showInifiniteBlocking();
    NetworkManager.getInstance().addToQueueAndWait(r);
    if(failed()) {
        ipDialog.dispose();
        if(!allowWithoutNetwork) {
            ipDialog.dispose();
            Dialog.show("Network Error", "Please try again later", "Exit", null);
            Display.getInstance().exitApplication();
        } else {
            return;
        }
    }
    Component c = getPendingAd();
    if(c != null) {
        Form adForm = new AdForm(c);
        adForm.setTransitionInAnimator(CommonTransitions.createEmpty());
        adForm.setTransitionOutAnimator(CommonTransitions.createEmpty());
        adForm.show();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:34,代码来源:FullScreenAdService.java

示例9: downloadUrlTo

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
private static boolean downloadUrlTo(String url, String fileName, boolean showProgress, boolean background, boolean storage, ActionListener callback) {
    ConnectionRequest cr = new ConnectionRequest();
    cr.setPost(false);
    cr.setFailSilently(true);
    cr.setReadResponseForErrors(false);
    cr.setDuplicateSupported(true);
    cr.setUrl(url);
    if(callback != null) {
        cr.addResponseListener(callback);
    }
    if(storage) {
        cr.setDestinationStorage(fileName);
    } else {
        cr.setDestinationFile(fileName);
    }
    if(background) {
        NetworkManager.getInstance().addToQueue(cr);
        return true;
    } 
    if(showProgress) {
        InfiniteProgress ip = new InfiniteProgress();
        Dialog d = ip.showInifiniteBlocking();
        NetworkManager.getInstance().addToQueueAndWait(cr);
        d.dispose();
    } else {
        NetworkManager.getInstance().addToQueueAndWait(cr);
    }
    int rc = cr.getResponseCode();
    return rc == 200 || rc == 201;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:31,代码来源:Util.java

示例10: downloadUrlTo

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
private static boolean downloadUrlTo(String url, String fileName, boolean showProgress, boolean background, boolean storage, ActionListener callback) {
    ConnectionRequest cr = new ConnectionRequest();
    cr.setPost(false);
    cr.setFailSilently(true);
    cr.setUrl(url);
    if(callback != null) {
        cr.addResponseListener(callback);
    }
    if(storage) {
        cr.setDestinationStorage(fileName);
    } else {
        cr.setDestinationFile(fileName);
    }
    if(background) {
        NetworkManager.getInstance().addToQueue(cr);
        return true;
    } 
    if(showProgress) {
        InfiniteProgress ip = new InfiniteProgress();
        Dialog d = ip.showInifiniteBlocking();
        NetworkManager.getInstance().addToQueueAndWait(cr);
        d.dispose();
    } else {
        NetworkManager.getInstance().addToQueueAndWait(cr);
    }
    return cr.getResponseCode() == 200;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:28,代码来源:Util.java

示例11: show

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
public static void show(String title, String text, final Command cmd)
{        
    int popupWidth = Display.getInstance().getCurrent().getWidth() - StateMachine.getPixelFromMM(10, true);
    if(popupWidth > StateMachine.getPixelFromMM(40,true))
        popupWidth = StateMachine.getPixelFromMM(40,true);
    
    final Dialog dia = new Dialog();
    dia.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
    dia.getDialogStyle().setBgTransparency(0);
    
    Command backCommand = new Command(null){
        @Override
        public void actionPerformed(ActionEvent ev) {
            dia.dispose();
        }
    };
    dia.setBackCommand(backCommand);

    SpanLabel lblTitle = new SpanLabel(title);
    lblTitle.setUIID("ViewOptionsRowFirst");
    lblTitle.setTextUIID("ViewOptionsRowFirstText");
    lblTitle.setPreferredW(popupWidth);
    dia.addComponent(lblTitle);
    
    SpanLabel lblText = new SpanLabel(text);
    lblText.setUIID("ViewOptionsRow");
    lblText.setTextUIID("ViewOptionsRowText");
    lblText.setPreferredW(popupWidth);
    dia.addComponent(lblText);
    
    Container ctn = new Container(new LayeredLayout());

    Button closebg = new Button();
    closebg.setUIID("ViewOptionsRowLast");
    closebg.getStyle().setBgTransparency(0);
    closebg.setPreferredW(popupWidth);
    ctn.addComponent(closebg);

    Container ctnButtons = new Container(new BoxLayout(BoxLayout.Y_AXIS));
    ctnButtons.getStyle().setMargin(StateMachine.getPixelFromMM(2, false), StateMachine.getPixelFromMM(2, false), StateMachine.getPixelFromMM(2, true), StateMachine.getPixelFromMM(2, true));
    ctn.addComponent(ctnButtons);
    
    Button close = new Button(StateMachine._translate("button_ok", "[default] Ok"));
    if (cmd != null && cmd.getCommandName() != null)
        close.setText(cmd.getCommandName());
    close.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            if (cmd != null)
                cmd.actionPerformed(evt);
            dia.dispose();
        }
    });
    close.setUIID("ViewOptionsRowClose");
    close.setVerticalAlignment(Label.CENTER);
    
    ctnButtons.addComponent(close);
    dia.addComponent(ctn);
    
    dia.showPacked(BorderLayout.CENTER, true);
}
 
开发者ID:martijn00,项目名称:MusicPlayerCodenameOne,代码行数:61,代码来源:DialogNotice.java


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