Java Code Examples for com.codename1.ui.TextArea#setEditable()
The following examples show how to use
com.codename1.ui.TextArea#setEditable() .
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: Flickr.java From codenameone-demos with GNU General Public License v2.0 | 6 votes |
public static Form createMainForm() { Form main = new Form("Flickr tags"); main.setLayout(new BorderLayout()); Toolbar bar = new Toolbar(); main.setToolBar(bar); addCommandsToToolbar(bar); TextArea desc = new TextArea(); desc.setText("This is a Flickr tags demo, the demo uses the Toolbar to arrange the Form Commands.\n\n" + "Select \"Cats\" to view the latest photos that were tagged as \"Cats\".\n\n" + "Select \"Dogs\" to view the latest photos that were tagged as \"Dogs\".\n\n" + "Select \"Search\" to enter your own tags for search."); desc.setEditable(false); main.addComponent(BorderLayout.CENTER, desc); return main; }
Example 2
Source File: SpanButton.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
/** * Constructor accepting default text */ public SpanButton(String txt) { setUIID("Button"); setLayout(new BorderLayout()); text = new TextArea(getUIManager().localize(txt, txt)); text.setColumns(100); text.setUIID("Button"); text.setGrowByContent(true); text.setEditable(false); text.setFocusable(false); text.setActAsLabel(true); setFocusable(true); removeBackground(text.getUnselectedStyle()); removeBackground(text.getSelectedStyle()); removeBackground(text.getPressedStyle()); removeBackground(text.getDisabledStyle()); actualButton = new Button(); actualButton.setUIID("icon"); addComponent(BorderLayout.WEST, actualButton); Container center = BoxLayout.encloseYCenter(text); center.getStyle().setMargin(0, 0, 0, 0); center.getStyle().setPadding(0, 0, 0, 0); addComponent(BorderLayout.CENTER, center); setLeadComponent(actualButton); updateGap(); }
Example 3
Source File: SpanLabel.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
/** * Constructor accepting default text */ public SpanLabel(String txt) { setUIID("Container"); setLayout(new BorderLayout()); text = new TextArea(getUIManager().localize(txt, txt)); text.setActAsLabel(true); text.setColumns(text.getText().length() + 1); text.setGrowByContent(true); text.setUIID("Label"); text.setEditable(false); text.setFocusable(false); icon = new Label(); icon.setUIID("icon"); iconWrapper = new Container(new FlowLayout(CENTER, CENTER)); iconWrapper.getAllStyles().stripMarginAndPadding(); iconWrapper.add(icon); addComponent(BorderLayout.WEST, iconWrapper); addComponent(BorderLayout.CENTER, BoxLayout.encloseYCenter(text)); updateGap(); }
Example 4
Source File: SharedJavascriptContextSample.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void start() { if(current != null){ current.show(); return; } Form hi = new Form("Hi World", new BorderLayout()); TextArea input = new TextArea(); TextArea output = new TextArea(); output.setEditable(false); Button execute = new Button("Run"); execute.addActionListener(evt->{ BrowserComponent bc = CN.getSharedJavascriptContext().ready().get(); bc.execute("callback.onSuccess(window.eval(${0}))", new Object[]{input.getText()}, res->{ output.setText(res.toString()); }); }); SplitPane split = new SplitPane(SplitPane.VERTICAL_SPLIT, input, output, "0", "50%", "99%"); hi.add(CENTER, split); hi.add(NORTH, execute); hi.show(); }
Example 5
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 6
Source File: ToastBar.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
public ToastBarComponent() { this.getAllStyles().setBgColor(0x0); this.getAllStyles().setBackgroundType(Style.BACKGROUND_NONE); this.getAllStyles().setBgTransparency(128); setVisible(false); label = new TextArea(); label.setUIID(defaultMessageUIID); label.setEditable(false); label.setFocusable(false); label.setVerticalAlignment(CENTER); progressLabel = new InfiniteProgress(); progressLabel.setAngleIncrease(4); progressLabel.setVisible(false); icon = new Label(); icon.setVisible(false); progressBar = new Slider(); progressBar.setVisible(false); leadButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (currentlyShowing != null && !currentlyShowing.showProgressIndicator ) { currentlyShowing.clear(); } ToastBar.this.setVisible(false); } }); leadButton.setVisible(false); this.setLeadComponent(leadButton); setLayout(new BorderLayout()); addComponent(BorderLayout.WEST, icon); addComponent(BorderLayout.CENTER, label); addComponent(BorderLayout.SOUTH, progressBar); addComponent(BorderLayout.EAST, progressLabel); progressBar.setVisible(false); }