public void startApp() { textBox = new TextBox("Ophone", "\n", 512, TextField.UNEDITABLE); OxportMIDlet.addtext("Listo para exportar servicios..."); textBox.addCommand(exitCom); textBox.addCommand(playCom); textBox.addCommand(initCom); textBox.setCommandListener(this); display.setCurrent(textBox); }
public ExpandedWindow(boolean decorations) { super("ExpandedWindow"); this.decorations = decorations; Panel content = new Panel(); content.setLayoutManager(new BorderLayout()); TextBox textBox = new TextBox(TestUtils.downloadGPL(), TextBox.Style.MULTI_LINE); textBox.setLayoutData(BorderLayout.Location.CENTER); textBox.setReadOnly(true); content.addComponent(textBox); setComponent(content); setHints( this.decorations ? Arrays.asList(Hint.EXPANDED) : Arrays.asList(Hint.EXPANDED, Hint.NO_DECORATIONS)); }
/** Ask the user for the URL. */ private void getUrl() { try { if (urlTextBox == null) { urlTextBox = new TextBox( Resource.getString(ResourceConstants.AMS_DISC_APP_WEBSITE_INSTALL), defaultInstallListUrl, 1024, TextField.ANY); urlTextBox.addCommand(endCmd); urlTextBox.addCommand(saveCmd); urlTextBox.addCommand(discoverCmd); urlTextBox.setCommandListener(this); } display.setCurrent(urlTextBox); } catch (Exception ex) { displayException(Resource.getString(ResourceConstants.EXCEPTION), ex.toString()); } }
public void commandAction(Command c, Displayable s) { if (c == exitCom) { destroyApp(true); notifyDestroyed(); } else if (c == initCom) { if (ox == null) { textBox.insert("Exportando...\n", textBox.size()); ox = new Oxport(); ox.start(); } } else if (c == playCom) { if ((ox == null) || (ox.getOServer() == null)) addtext("Playground need a OServer running"); else { if (playground == null) playground = new PlayGround(this); display.setCurrent(playground); } } else { } }
/** * Respond to a command issued on any Screen. * * @param c command activated by the user * @param s the Displayable the command was on. */ public void commandAction(Command c, Displayable s) { if (c == discoverCmd) { // user wants to discover the suites that can be installed discoverSuitesToInstall(urlTextBox.getString()); } else if (s == installListBox && (c == List.SELECT_COMMAND || c == installCmd)) { installSuite(installListBox.getSelectedIndex()); } else if (c == backCmd) { display.setCurrent(urlTextBox); } else if (c == saveCmd) { saveURLSetting(); } else if (c == endCmd || c == Alert.DISMISS_COMMAND) { // goto back to the manager midlet notifyDestroyed(); } }
/** Save the URL setting the user entered in to the urlTextBox. */ private void saveURLSetting() { String temp; Exception ex; temp = urlTextBox.getString(); ex = GraphicalInstaller.saveSettings(temp, MIDletSuite.INTERNAL_SUITE_ID); if (ex != null) { displayException(Resource.getString(ResourceConstants.EXCEPTION), ex.toString()); return; } defaultInstallListUrl = temp; displaySuccessMessage(Resource.getString(ResourceConstants.AMS_MGR_SAVED)); }
@Override public void init(WindowBasedTextGUI textGUI) { final BasicWindow window = new BasicWindow("Grid layout test"); final Panel leftPanel = new Panel(); Panel checkBoxPanel = new Panel(); for (int i = 0; i < 4; i++) { CheckBox checkBox = new CheckBox("Checkbox #" + (i + 1)); checkBoxPanel.addComponent(checkBox); } Panel textBoxPanel = new Panel(); textBoxPanel.addComponent( Panels.horizontal(new Label("Normal: "), new TextBox(new TerminalSize(12, 1), "Text"))); textBoxPanel.addComponent( Panels.horizontal( new Label("Password: "******"Text").setMask('*'))); Panel buttonPanel = new Panel(); buttonPanel.addComponent( new Button( "Enable spacing", new Runnable() { @Override public void run() { LinearLayout layoutManager = (LinearLayout) leftPanel.getLayoutManager(); layoutManager.setSpacing(layoutManager.getSpacing() == 0 ? 1 : 0); } })); leftPanel.addComponent(checkBoxPanel.withBorder(Borders.singleLine("CheckBoxes"))); leftPanel.addComponent(textBoxPanel.withBorder(Borders.singleLine("TextBoxes"))); leftPanel.addComponent(buttonPanel.withBorder(Borders.singleLine("Buttons"))); Panel rightPanel = new Panel(); textBoxPanel = new Panel(); TextBox readOnlyTextArea = new TextBox(new TerminalSize(16, 8)); readOnlyTextArea.setReadOnly(true); readOnlyTextArea.setText(TestUtils.downloadGPL()); textBoxPanel.addComponent(readOnlyTextArea); rightPanel.addComponent(textBoxPanel.withBorder(Borders.singleLine("Read-only"))); rightPanel.setLayoutData(LinearLayout.createLayoutData(LinearLayout.Alignment.Fill)); Panel contentArea = new Panel(); contentArea.setLayoutManager(new LinearLayout(Direction.VERTICAL)); contentArea.addComponent(Panels.horizontal(leftPanel, rightPanel)); contentArea.addComponent( new Separator(Direction.HORIZONTAL) .setLayoutData(LinearLayout.createLayoutData(LinearLayout.Alignment.Fill))); contentArea.addComponent( new Button( "OK", new Runnable() { @Override public void run() { window.close(); } }) .setLayoutData(LinearLayout.createLayoutData(LinearLayout.Alignment.Center))); window.setComponent(contentArea); textGUI.addWindow(window); }
public static void addtext(String text) { if (textBox != null) textBox.insert(text + "\n", textBox.size()); }