private void login() throws Exception { try { stop(); sshSession.disconnect(); LoginDialog loginDialog = new LoginDialog(RemoteMain.this, sshUserInfo); int result = loginDialog.showDialog(); if (result == JOptionPane.OK_OPTION) { sshSession.login(sshUserInfo, sshOptions); toggleConnected(); start(); } } catch (Exception e) { sshUserInfo.setPassword(null); sshUserInfo.setPassphrase(null); // sshUserInfo = new SSHUserInfo(); JOptionPane.showMessageDialog( this, "Failed to connect.\nReason: " + e.getMessage(), "Connection error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); throw e; } }
public void actionPerformed(ActionEvent e) { Client c = this.getFrame().getClient(); LoginDialog l = this.getFrame().getLoginDialog(); c.setUserName(l.getLoginField().getText()); c.setPassword(l.getPwdField().getText()); c.register(); this.getFrame().setTitle("iChat - " + l.getLoginField().getText()); }
/** * The method shows a login dialog for a given URI. The user field is taken from the URI if a user * is present in the URI. In this case the user is not editable. * * @param parent * @param uri * @return credentials, <code>null</code> if the user canceled the dialog. */ public static UserPasswordCredentials login(Shell parent, URIish uri) { LoginDialog dialog = new LoginDialog(parent, uri); if (dialog.open() == Window.OK) { UserPasswordCredentials credentials = dialog.getCredentials(); if (credentials != null && dialog.getStoreInSecureStore()) SecureStoreUtils.storeCredentials(credentials, uri); return credentials; } return null; }
public void parseRegError(String error) { showRegProgressbar(false); if (error != null) { Toast.makeText(getContext(), error, Toast.LENGTH_SHORT).show(); presenter.getCodeImage(formInfo.getOnce()); } else { Toast.makeText(getContext(), "注册成功", Toast.LENGTH_SHORT).show(); LoginDialog loginDialog = new LoginDialog(getContext()); dismiss(); loginDialog.show(); } }
/** * The method shows a change credentials dialog for a given URI. The user field is taken from the * URI if a user is present in the URI. In this case the user is not editable. * * @param parent * @param uri * @return credentials, <code>null</code> if the user canceled the dialog. */ public static UserPasswordCredentials changeCredentials(Shell parent, URIish uri) { LoginDialog dialog = new LoginDialog(parent, uri); dialog.setChangeCredentials(true); UserPasswordCredentials oldCredentials = SecureStoreUtils.getCredentials(uri); if (oldCredentials != null) dialog.setOldUser(oldCredentials.getUser()); if (dialog.open() == Window.OK) { UserPasswordCredentials credentials = dialog.getCredentials(); if (credentials != null) SecureStoreUtils.storeCredentials(credentials, uri); return credentials; } return null; }
private void showLoginForm() { loginDialog.showDialog(); if (!loginDialog.isCanceled()) { ClientSession clientSession = loginDialog.getClientSession(); model.setClientSession(clientSession); try { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); model.loadFolder(clientSession.getStartFolderId(), false); model.loadObject(clientSession.getStartFolderId()); toolbarButton[BUTTON_REPOSITORY_INFO].setEnabled(true); toolbarButton[BUTTON_TYPES].setEnabled(true); toolbarButton[BUTTON_QUERY].setEnabled(model.supportsQuery()); toolbarButton[BUTTON_CHANGELOG].setEnabled(model.supportsChangeLog()); toolbarButton[BUTTON_CONSOLE].setEnabled(true); toolbarButton[BUTTON_TCK].setEnabled(true); toolbarButton[BUTTON_CREATE].setEnabled(true); itemMenuItem.setEnabled(model.supportsItems()); relationshipMenuItem.setEnabled(model.supportsRelationships()); policyMenuItem.setEnabled(model.supportsPolicies()); String user = clientSession.getSessionParameters().get(SessionParameter.USER); if (user != null) { user = "******" + user + ")"; } else { user = ""; } setTitle( WINDOW_TITLE + user + " - " + clientSession.getSession().getRepositoryInfo().getName()); } catch (Exception ex) { toolbarButton[BUTTON_REPOSITORY_INFO].setEnabled(false); toolbarButton[BUTTON_TYPES].setEnabled(false); toolbarButton[BUTTON_QUERY].setEnabled(false); toolbarButton[BUTTON_CHANGELOG].setEnabled(false); toolbarButton[BUTTON_CONSOLE].setEnabled(false); toolbarButton[BUTTON_TCK].setEnabled(false); toolbarButton[BUTTON_CREATE].setEnabled(false); ClientHelper.showError(null, ex); setTitle(WINDOW_TITLE); } finally { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }
private void showLoginDialog() { String message = "Please sign in with your username and password:"******"Login", message, "john"); int returnCode = loginDialog.open(); String resultText = "Result: " + getReturnCodeText(returnCode); if (returnCode == Window.OK) { String username = loginDialog.getUsername(); String password = loginDialog.getPassword(); String pwInfo = password == null ? "n/a" : password.length() + " chars"; resultText += ", user: "******", password: " + pwInfo; } loginDlgResLabel.setText(resultText); loginDlgResLabel.pack(); }
@Override public void actionPerformed(ActionEvent e) { // Prompt user for login and password LoginDialog l = new LoginDialog(this.getFrame()); l.setLocationRelativeTo(this.getFrame()); l.setVisible(true); l.setModal(true); l.pack(); this.getFrame().getCallButton().setEnabled(true); this.getFrame().getQuitButton().setEnabled(true); this.getFrame().getCreateGroupButton().setEnabled(true); this.getFrame().getCallGroupButton().setEnabled(true); // System.out.println("Event fired"); }
private void launch() { try { final Instance instance = launcher.getInstances().get(instancesTable.getSelectedRow()); boolean update = updateCheck.isSelected() && instance.isUpdatePending(); // Store last access date Date now = new Date(); instance.setLastAccessed(now); Persistence.commitAndForget(instance); // Perform login final Session session = LoginDialog.showLoginRequest(this, launcher); if (session == null) { return; } // If we have to update, we have to update if (!instance.isInstalled()) { update = true; } if (update) { // Execute the updater Updater updater = new Updater(launcher, instance); updater.setOnline(session.isOnline()); ObservableFuture<Instance> future = new ObservableFuture<Instance>( launcher.getExecutor().submit(updater), updater); // Show progress ProgressDialog.showProgress( this, future, _("launcher.updatingTitle"), _("launcher.updatingStatus", instance.getTitle())); SwingHelper.addErrorDialogCallback(this, future); // Update the list of instances after updating future.addListener(new Runnable() { @Override public void run() { instancesModel.update(); } }, SwingExecutor.INSTANCE); // On success, launch also Futures.addCallback(future, new FutureCallback<Instance>() { @Override public void onSuccess(Instance result) { launch(instance, session); } @Override public void onFailure(Throwable t) { } }, SwingExecutor.INSTANCE); } else { launch(instance, session); } } catch (ArrayIndexOutOfBoundsException e) { SwingHelper.showErrorDialog(this, _("launcher.noInstanceError"), _("launcher.noInstanceTitle")); } }
private List<ChangeInfo> getChanges(Project project, boolean requestSettingsIfNonExistent) { final GerritSettings settings = GerritSettings.getInstance(); String apiUrl = GerritApiUtil.getApiUrl(); if (Strings.isNullOrEmpty(apiUrl)) { if (requestSettingsIfNonExistent) { final LoginDialog dialog = new LoginDialog(project); dialog.show(); if (!dialog.isOK()) { return Collections.emptyList(); } apiUrl = GerritApiUtil.getApiUrl(); } else { return Collections.emptyList(); } } return GerritUtil.getChanges(apiUrl, settings.getLogin(), settings.getPassword()); }
public String loginLogout(MainFrame frame) { String res = ""; // 結果を入れる変数 if (flagLogin) { flagLogin = false; frame.buttonLog.setLabel(" ログイン"); } else { LoginDialog ld = new LoginDialog(frame); ld.setVisible(true); ld.setModalityType(LoginDialog.ModalityType.APPLICATION_MODAL); if (ld.canceled) { return ""; } reservation_userid = ld.tfUserID.getText(); String password = ld.tfPassword.getText(); // (2) MySQLの操作(SELECT文の実行) try { // userの情報を取得するクエリ MySQL mysql = new MySQL(); ResultSet rs = mysql.getLogin(reservation_userid); if (rs.next()) { rs.getString("password"); String password_from_db = rs.getString("password"); if (password_from_db.equals(password)) { // 認証成功 flagLogin = true; frame.buttonLog.setLabel("ログアウト"); res = ""; } else { // 認証失敗 res = "ログインできません.ID パスワードが違います"; } } else { // 認証失敗; res = "ログインできません.ID パスワードが違います。"; } } catch (Exception e) { e.printStackTrace(); } } return res; }
/** Initialize the parameter, nothing right now */ public void initialize() { OBADBManager DBManager = OBADBManager.getInstance(); HashMap<String, String> savedUserInfos = DBManager.getRememberPasswd(); if (loginWithSavePasswd(savedUserInfos)) { setVCLConnector(username, password); showMainOBA(); } else { loginOBA = new LoginDialog(); loginOBA.show(); } }
private void launch() { boolean offlineOnly = false; if(LauncherFrame.this.updateUrl != null) { SwingHelper.showMessageDialog( LauncherFrame.this, _("launcher.selfUpdateComplete"), _("errors.launchImpossible"), null, JOptionPane.ERROR_MESSAGE); return; } if(LauncherFrame.this.updateRequired) { offlineOnly = true; if(!SwingHelper.confirmDialog( LauncherFrame.this, _("errors.offlineOnly"), _("errors.genericError"))) return; } try { final Instance instance = launcher.getInstances().get(instancesTable.getSelectedRow()); // Store last access date Date now = new Date(); instance.setLastAccessed(now); Persistence.commitAndForget(instance); // Perform login final Session session = offlineOnly ? (new OfflineSession(launcher.getProperties().getProperty("offlinePlayerName"))) : LoginDialog.showLoginRequest(this, launcher); if (session == null) { return; } // Execute the updater Updater updater = new Updater(launcher, instance); updater.setSelectFeatures(configureFeaturesCheck.isSelected()); updater.setOnline(session.isOnline()); ObservableFuture<Instance> future = new ObservableFuture<Instance>( launcher.getExecutor().submit(updater), updater); // Show progress ProgressDialog.showProgress( this, future, _("launcher.updatingTitle"), _("launcher.updatingStatus", instance.getTitle())); SwingHelper.addErrorDialogCallback(this, future); // Update the list of instances after updating future.addListener(new Runnable() { @Override public void run() { instancesModel.update(); } }, SwingExecutor.INSTANCE); // On success, launch also Futures.addCallback(future, new FutureCallback<Instance>() { @Override public void onSuccess(Instance result) { launch(instance, session); } @Override public void onFailure(Throwable t) { } }, SwingExecutor.INSTANCE); } catch (ArrayIndexOutOfBoundsException e) { SwingHelper.showErrorDialog(this, _("launcher.noInstanceError"), _("launcher.noInstanceTitle")); } }
@Override public void actionPerformed(ActionEvent event) { String cmd = event.getActionCommand(); statusBar.setStatus("Befehl " + cmd + " wird ausgefuehrt..."); System.out.println(cmd); if (cfg.useCmd_log()) { SendToServer.info("Action:" + cmd); } /* * Aufruf einer "Unterfunktion" in separatem thread: * * !!! Setzt aber voraus, daß der ActionListener in einem separaten * "NichtSwingThread" läuft! * * SwingUtilities.invokeLater(new Runnable() { * * public void run() { jIntKfzLb lb = new jIntKfzLb(); MyEventListener * el = new MyEventListener(); lb.addMyEventListener(el); * lb.setVisible(true); dp.add(lb); } }); } */ /* * LOGIN mit Aufbau Vbdg. */ if (cmd.equals("Anmeldung")) { this.cfg.initLDAP(); this.gui.initMenu(); this.cfg.setDst_list(null); System.out.println("Starte Anmelde-Prozess..."); lD = LoginDialog.getInstance(); } if (cmd.equals("USER")) { String user = LoginDialog.getInstance().getUserName(); this.snd.play(Sound.SoundClip.KASSE); if (this.cfg.isDebug()) { System.out.println("USER: "******"LOGIN")) { if (this.cfg.isWaitPanel() && this.cfg.isUseSwingWorker()) { this.workerWait = new SwingWorker<String, Void>() { @Override protected String doInBackground() { wt = new Wait("WARTE", "Anmeldung am System..."); return "OK"; } @Override protected void done() {} }; workerLogin = new SwingWorker<String, Void>() { @Override protected String doInBackground() { gui.login2(); return "OK"; } @Override protected void done() { wt.stop(); } }; // bei Anmeldung wird versucht, LOG-Eintrag zu erstellen, auch // wenn eventuell vorher die Vbdg. zum CMD-Server ohne Erfolg war cfg.setCmd_log(true); workerWait.execute(); workerLogin.execute(); } else { CursorTools.startWaitCursor(gui); gui.login2(); CursorTools.stopWaitCursor(gui); } } if (cmd.equals("ABBRUCH")) { if (lD != null) { System.out.println("Abbruch LOGIN- Bearbeitung..."); lD.close(); lD = null; cfg.initLDAP(); cfg.setLogin_usr(""); cfg.setLogin_pwd(""); cfg.setLogin_ok(false); Jan.logger.info("===> Abbruch der Anmeldung "); snd.play(Sound.SoundClip.LASER); gui.setTitle(cfg.getTitle() + " <NICHT ANGEMELDET>"); } } // mit VM verbinden if (cmd.equals("CVM")) { if (cfg.isLogin_ok()) { act_dst = ""; dl = LdapEntry_Parser.parse_protocol(cfg.getLdap_vm().trim()); if (dl != null) { if (dl.getEntryNum() > 1) { SelectDestination sd = new SelectDestination(); act_dst = sd.getDestination(dl); } else if (dl.getEntryNum() == 1) { act_dst = dl.getDstList().get(0).getDestinationTitle(); } else { System.out.println("CVM: destination list is empty!!!"); } } else { System.out.println("CVM: destination list is NULL!!!"); } if (cfg.isDebug()) { System.out.print("selected destination: " + act_dst + "\n"); } StartClientReturnCode rc = Destination_Hub.startThis(act_dst); } else { String msg = "\n Sie sind nicht erfolgreich angemeldet! \n\n"; if (cfg.isInternalFrames()) { JOptionPane.showInternalMessageDialog( gui.getContentPane(), msg, "FEHLER", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(gui, msg, "FEHLER", JOptionPane.ERROR_MESSAGE); } } } // Info/Version if (cmd.equals("VERSION")) { snd.play(Sound.SoundClip.TAB); String msg = "\n Titel: " + cfg.getTitle() + "\n Version: " + cfg.getVersion() + "\n\n Autor: " + cfg.getAutor() + "\n\n Info: " + cfg.getInfo() + "\n\n"; if (cfg.isInternalFrames()) { JOptionPane.showInternalMessageDialog( gui.getContentPane(), msg, "Info", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(gui, msg, "Info", JOptionPane.INFORMATION_MESSAGE); } } // Info/Umgebung if (cmd.equals("ENV")) { String param; snd.play(Sound.SoundClip.TAB); if (cfg.getLdap_vm().length() > 77) { param = cfg.getLdap_vm().substring(1, 77) + "..."; } else { param = cfg.getLdap_vm(); } String msg = "\n" + cfg.getTitle() + "\n" + cfg.getVersion() + "\n\n Host: " + cfg.getLocal_HostName() + "\n IP: " + cfg.getLocal_IP() + "\n MAC: " + cfg.getLocal_MAC() + "\n java version: " + cfg.getLocal_java_version() + "\n os name: " + cfg.getLocal_os_name() + "\n linux Rel.: " + cfg.getLinuxRelease() + "\n jvm version: " + cfg.getLocal_jvm_version() + "\n\n user: "******"\n context: " + cfg.getLogin_context() + "\n PARAM: " + param + "\n eMail: " + cfg.getLdap_mail() + "\n fullName: " + cfg.getLdap_fullName() + "\n last login time: " + Tools.t2s(cfg.getLdap_loginTime()) + "\n login exp. time: " + Tools.t2s(cfg.getLdap_passwordExpirationTime()) + "\n login disabled : " + cfg.getLdap_loginDisabled() + "\n login grace limit : " + cfg.getLdap_loginGraceLimit() + "\n login grace remaining : " + cfg.getLdap_loginGraceRemaining() + "\n passwordMinimumLength : " + cfg.getLdap_passwordMinimumLength() + "\n passwordUniqueRequired: " + cfg.getLdap_passwordUniqueRequired() + "\n\n"; if (cfg.isInternalFrames()) { JOptionPane.showInternalMessageDialog( gui.getContentPane(), msg, "Umgebung", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(gui, msg, "Umgebung", JOptionPane.INFORMATION_MESSAGE); } } // Info/Uhr if (cmd.equals("UHR")) { JDialog f = new JDialog(); f.setTitle("Uhr-Zeit"); f.setIconImage(res.clockIcon); f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); f.setResizable(false); f.getContentPane().add(new Clock()); f.pack(); f.setLocationRelativeTo(null); f.setAlwaysOnTop(true); f.setResizable(false); f.setVisible(true); } // Hilfe001 if (cmd.equals("HELP001")) { Calendar cal = Calendar.getInstance(); int day = cal.get(Calendar.DAY_OF_MONTH); int month = cal.get(Calendar.MONTH); if (day == 7 && month == 9) { // 7. October Help00x.show(); } else { Help000.show(); } } // CountDown via ProgressMonitor if (cmd.equals("CNTDWN")) { final JDialog f = new JDialog(); f.setTitle("FRAGE"); f.setResizable(false); f.setIconImage(res.clockIcon); f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); f.setSize(290, 220); JLabel l1 = new JLabel("Start-Befehl wurde gesendet."); JLabel l2 = new JLabel(" Was soll ich jetzt tun?"); final JButton ok = new JButton("VERBINDEN"); ok.setMnemonic('v'); ok.setIcon(res.computerImageIcon); ok.setToolTipText("Verbindung wird erneut versucht."); ok.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { gui.getInstance().startRHEV(true); f.dispose(); } }); final JButton cancel = new JButton("Abbruch"); cancel.setMnemonic('a'); cancel.setIcon(res.cancelImageIcon); cancel.setToolTipText("Funktion abbrechen."); cancel.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { f.dispose(); } }); JPanel p = new JPanel(); p.setLayout(new BorderLayout()); JPanel p_north = new JPanel(); JPanel p_south = new JPanel(); JPanel p_center = new JPanel(); JPanel p_east = new JPanel(); JPanel p_west = new JPanel(); p_center.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)); p_north.add(l1); p_center.add(l2); p_south.add(ok); p_south.add(cancel); p.add(BorderLayout.NORTH, p_north); p.add(BorderLayout.SOUTH, p_south); p.add(BorderLayout.CENTER, p_center); p.add(BorderLayout.EAST, p_east); p.add(BorderLayout.WEST, p_west); CountDown cd = new CountDown(cfg.getRhevCntDwnVMstart()); // p.add(cd); f.add(p); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); cd.start(); } // Senden if (cmd.equals("SENDEN")) { if (cfg.isLogin_ok()) { System.out.println("starte Sende-Dialog!"); int result = ImportSelector.selectFiles(); if (result > 0) { System.out.println("" + result + " Dateien übertragen"); } else { System.out.println("Fehler " + result + " beim Senden der Dateien aufgetreten."); } } else { String msg = "\n Sie sind nicht erfolgreich angemeldet! \n\n"; if (cfg.isInternalFrames()) { JOptionPane.showInternalMessageDialog( gui.getContentPane(), msg, "FEHLER", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(gui, msg, "FEHLER", JOptionPane.ERROR_MESSAGE); } } } // Empfangen if (cmd.equals("EMPFANGEN")) { if (cfg.isLogin_ok()) { System.out.println("starte Empfang-Dialog!"); int result = ExportSelector.selectFiles(); if (result > 0) { System.out.println("" + result + " Dateien kopiert"); } else { System.out.println("Fehler " + result + " beim Empfang der Dateien aufgetreten."); } } else { String msg = "\n Sie sind nicht erfolgreich angemeldet! \n\n"; if (cfg.isInternalFrames()) { JOptionPane.showInternalMessageDialog( gui.getContentPane(), msg, "FEHLER", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(gui, msg, "FEHLER", JOptionPane.ERROR_MESSAGE); } } } // Programm-Ende if (cmd.equals("ENDE")) { gui.sac(); } // Computer ausschalten if (cmd.equals("SHUTDOWN")) { System.out.println("Starte Shutdown-Prozess..."); gui.shutdownClient(); } statusBar.setStatus("Befehl " + cmd + " beendet."); }
public void onModuleLoad() { GXT.setDefaultTheme(Theme.GRAY, true); Window gridWindow = createGridWindow(); Window accordionWindow = createAccordionWindow(); Window statisticWindow = createStatisticWindow(); Window geolocationWindow = createGeolocationWindow(); Window prezioWindow = createPrezioWindow(); Window videoWindow = createVideoWindow(); // Dispatcher dispatcher = Dispatcher.get(); // dispatcher.dispatch(AppEvents.Login); // desktop.getDesktop().hide(); // desktop.getShortcuts().noti // desktop.getDesktop().setEnabled(false); // desktop.getDesktop().hide(); // GXT.hideLoadingPanel("loading"); // desktop.getDesktop().setEnabled(true); // desktop.getDesktop().show(); // desktop.getDesktop().setZIndex(10); // desktop.getTaskBar().setVisible(false); Window w = getEmptyWindow(); desktop.addWindow(w); w.show(); w.maximize(); LoginDialog login = new LoginDialog(w); w.setZIndex(1); login.show(); login.focus(); login.setVisible(true); desktop.addWindow(prezioWindow); prezioWindow.show(); prezioWindow.maximize(); prezioWindow.focus(); // login.setZIndex(15); SelectionListener<MenuEvent> menuListener = new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent me) { itemSelected(me); } }; SelectionListener<ComponentEvent> shortcutListener = new SelectionListener<ComponentEvent>() { @Override public void componentSelected(ComponentEvent ce) { itemSelected(ce); } }; Shortcut s1 = new Shortcut(); s1.setText("Messages Window"); s1.setId("grid-win-shortcut"); s1.setData("window", gridWindow); s1.addSelectionListener(shortcutListener); desktop.addShortcut(s1); Shortcut s2 = new Shortcut(); s2.setText("Contact list"); s2.setId("acc-win-shortcut"); s2.setData("window", accordionWindow); s2.addSelectionListener(shortcutListener); desktop.addShortcut(s2); Shortcut s3 = new Shortcut(); s3.setText("Statistics"); s3.setId("stat-win-shortcut"); s3.setData("window", statisticWindow); s3.addSelectionListener(shortcutListener); desktop.addShortcut(s3); TaskBar taskBar = desktop.getTaskBar(); StartMenu menu = taskBar.getStartMenu(); menu.setHeading("Eurecom Presentation!"); menu.setIconStyle("user"); MenuItem menuItem = new MenuItem("Messages Window"); menuItem.setData("window", gridWindow); menuItem.setIcon(IconHelper.createStyle("icon-grid")); menuItem.addSelectionListener(menuListener); menu.add(menuItem); menuItem = new MenuItem("Archives Window"); menuItem.setIcon(IconHelper.createStyle("tabs")); menuItem.addSelectionListener(menuListener); menuItem.setData("window", createTabWindow()); menu.add(menuItem); menuItem = new MenuItem("Contact list"); menuItem.setIcon(IconHelper.createStyle("accordion")); menuItem.addSelectionListener(menuListener); menuItem.setData("window", accordionWindow); menu.add(menuItem); menuItem = new MenuItem("Statistic window"); menuItem.setIcon(IconHelper.createStyle("icon-statistic")); menuItem.addSelectionListener(menuListener); menuItem.setData("window", statisticWindow); menu.add(menuItem); menuItem = new MenuItem("Geolocation window"); menuItem.setIcon(IconHelper.createStyle("icon-geo")); menuItem.addSelectionListener(menuListener); menuItem.setData("window", geolocationWindow); menu.add(menuItem); menuItem = new MenuItem("Last messages"); menuItem.setIcon(IconHelper.createStyle("icon-sms-menu")); Menu sub = new Menu(); for (int i = 0; i < 3; i++) { MenuItem item = new MenuItem("Message " + (i + 1)); item.setData("window", createBogusWindow(i)); item.setIcon(IconHelper.createStyle("icon-sms")); item.addSelectionListener(menuListener); sub.add(item); } MenuItem item = new MenuItem("Received mms"); item.setIcon(IconHelper.createStyle("icon-video")); item.addSelectionListener(menuListener); item.setData("window", videoWindow); sub.add(item); item = new MenuItem("Presentation window"); item.setIcon(IconHelper.createStyle("icon-ppt")); item.addSelectionListener(menuListener); item.setData("window", prezioWindow); sub.add(item); menuItem.setSubMenu(sub); menu.add(menuItem); // tools MenuItem tool = new MenuItem("Settings"); tool.setIcon(IconHelper.createStyle("settings")); tool.addSelectionListener( new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent ce) { Info.display("Event", "The 'Settings' tool was clicked"); } }); menu.addTool(tool); menu.addToolSeperator(); tool = new MenuItem("Logout"); tool.setIcon(IconHelper.createStyle("logout")); tool.addSelectionListener( new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent ce) { Info.display("Event", "The 'Logout' tool was clicked"); } }); menu.addTool(tool); }