Java Code Examples for com.codename1.ui.Dialog#setLayout()
The following examples show how to use
com.codename1.ui.Dialog#setLayout() .
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: Oauth2.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
/** * This method preforms the actual authentication, this method is a blocking * method that will display the user the html authentication pages. * * @return the method if passes authentication will return the access token * or null if authentication failed. * * @throws IOException the method will throw an IOException if something * went wrong in the communication. * @deprecated use createAuthComponent or showAuthentication which work * asynchronously and adapt better to different platforms */ public String authenticate() { if (token == null) { login = new Dialog(); boolean i = Dialog.isAutoAdjustDialogSize(); Dialog.setAutoAdjustDialogSize(false); login.setLayout(new BorderLayout()); login.setScrollable(false); Component html = createLoginComponent(null, null, null, null); login.addComponent(BorderLayout.CENTER, html); login.setScrollable(false); login.setDialogUIID("Container"); login.setTransitionInAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL, true, 300)); login.setTransitionOutAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL, false, 300)); login.show(0, 0, 0, 0, false, true); Dialog.setAutoAdjustDialogSize(i); } return token; }
Example 2
Source File: DefaultCrashReporter.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ public void exception(Throwable t) { Preferences.set("$CN1_pendingCrash", true); if(promptUser) { Dialog error = new Dialog("Error"); error.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); TextArea txt = new TextArea(errorText); txt.setEditable(false); txt.setUIID("DialogBody"); error.addComponent(txt); CheckBox cb = new CheckBox(checkboxText); cb.setUIID("DialogBody"); error.addComponent(cb); Container grid = new Container(new GridLayout(1, 2)); error.addComponent(grid); Command ok = new Command(sendButtonText); Command dont = new Command(dontSendButtonText); Button send = new Button(ok); Button dontSend = new Button(dont); grid.addComponent(send); grid.addComponent(dontSend); Command result = error.showPacked(BorderLayout.CENTER, true); if(result == dont) { if(cb.isSelected()) { Preferences.set("$CN1_crashBlocked", true); } Preferences.set("$CN1_pendingCrash", false); return; } else { if(cb.isSelected()) { Preferences.set("$CN1_prompt", false); } } } Log.sendLog(); Preferences.set("$CN1_pendingCrash", false); }
Example 3
Source File: JavascriptScrollingTest.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
protected void onTest() { Dialog dlg = new Dialog("Test"); dlg.setLayout(new BorderLayout()); TextArea taMsg = new TextArea(); dlg.add(BorderLayout.CENTER, taMsg); Button btnOk = new Button("Ok"); btnOk.addActionListener(e -> dlg.dispose()); dlg.add(BorderLayout.SOUTH, btnOk); taMsg.setText("This is a test Message"); taMsg.setGrowLimit(-1); taMsg.getAllStyles().setAlignment(TextArea.LEFT); dlg.show(); }
Example 4
Source File: MasterDetail.java From CodenameOne with GNU General Public License v2.0 | 4 votes |
/** * @deprecated this was a half baked idea that made it into the public API */ public static void bindTabletLandscapeMaster(final Form rootForm, Container parentContainer, Component landscapeUI, final Component portraitUI, final String commandTitle, Image commandIcon) { landscapeUI.setHideInPortrait(true); parentContainer.addComponent(BorderLayout.WEST, landscapeUI); final Command masterCommand = new Command(commandTitle, commandIcon) { public void actionPerformed(ActionEvent ev) { Dialog dlg = new Dialog(); dlg.setLayout(new BorderLayout()); dlg.setDialogUIID("Container"); dlg.getContentPane().setUIID("Container"); Container titleArea = new Container(new BorderLayout()); dlg.addComponent(BorderLayout.NORTH, titleArea); titleArea.setUIID("TitleArea"); Label title = new Label(commandTitle); titleArea.addComponent(BorderLayout.CENTER, title); title.setUIID("Title"); Container body = new Container(new BorderLayout()); body.setUIID("Form"); body.addComponent(BorderLayout.CENTER, portraitUI); dlg.setTransitionInAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_HORIZONTAL, false, 250)); dlg.setTransitionOutAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_HORIZONTAL, true, 250)); dlg.addComponent(BorderLayout.CENTER, body); dlg.setDisposeWhenPointerOutOfBounds(true); dlg.showStetched(BorderLayout.WEST, true); dlg.removeComponent(portraitUI); } }; if(Display.getInstance().isPortrait()) { if(rootForm.getCommandCount() > 0) { rootForm.addCommand(masterCommand, 1); } else { rootForm.addCommand(masterCommand); } } rootForm.addOrientationListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if(portraitUI.getParent() != null) { Form f = Display.getInstance().getCurrent(); if(f instanceof Dialog) { ((Dialog)f).dispose(); } } if(Display.getInstance().isPortrait()) { rootForm.addCommand(masterCommand, 1); } else { rootForm.removeCommand(masterCommand); rootForm.revalidate(); } } }); }