com.codename1.ui.Dialog Java Examples

The following examples show how to use com.codename1.ui.Dialog. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SheetSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #2
Source File: TextFieldCaretColorTest2780.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #3
Source File: SSLCertificatePinningSample2.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if (err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });
}
 
Example #4
Source File: FadeOutTransitionSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #5
Source File: WKWebViewTest.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature, uncomment if you have a pro subscription
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #6
Source File: SSLCertificatePinningSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #7
Source File: LeadComponentScrollingTest3079.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #8
Source File: PhotoShare.java    From codenameone-demos with GNU General Public License v2.0 6 votes vote down vote up
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);
                }
            }
        };
}
 
Example #9
Source File: SocketSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #10
Source File: TabsAnimationSample2957.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if (err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });
}
 
Example #11
Source File: SpanLabelTestAllStyles2891.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #12
Source File: TestNativePlayerMode2972.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #13
Source File: LeftPaddingCSSTest3091.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #14
Source File: DragFinishedListenerTest3056.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if (err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });
}
 
Example #15
Source File: DialogPositioningSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #16
Source File: TestParparTranspileError2922.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #17
Source File: NestedTabsTest3023.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #18
Source File: ProgressAnimationsSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #19
Source File: AndroidTextFieldTests2905.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #20
Source File: TestNatives.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #21
Source File: SignIn.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example #22
Source File: SignIn.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example #23
Source File: WebSocketReconnectTest.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #24
Source File: JavascriptScrollingTest.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #25
Source File: CreateMediaRecorderSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #26
Source File: SimpleDateFormatTest.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #27
Source File: LongPointerPressTest3049.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #28
Source File: BadgesSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #29
Source File: UnitTests.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");
    UIManager.getInstance().getLookAndFeel().setRTL(true);

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if (err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });
}
 
Example #30
Source File: TextComponentSample2745.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}