} };  sendMenu.add(action);  action = new AbstractAction(LangTool.getString("popup.toImage")) { public void actionPerformed(ActionEvent e) { sendMeToImageFile();
   private void doPopup (MouseEvent me) {      JMenuItem menuItem;      Action action;      popup = new JPopupMenu();      final Gui5250 g = this;      JMenuItem mi;      final int pos = screen.getPosFromView(me.getX(),me.getY());      if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) {         action = new AbstractAction(LangTool.getString("popup.copy")) {               public void actionPerformed(ActionEvent e) {                  screen.copyField(pos);                  getFocusForMe();               }           };         popup.add(createMenuItem(action,MNEMONIC_COPY));         action = new AbstractAction(LangTool.getString("popup.paste")) {               public void actionPerformed(ActionEvent e) {                  screen.pasteMe(false);                  getFocusForMe();               }           };         popup.add(createMenuItem(action,MNEMONIC_PASTE));         action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) {               public void actionPerformed(ActionEvent e) {                  screen.pasteMe(true);                  getFocusForMe();               }           };         popup.add(action);         popup.addSeparator();      }      else {         action = new AbstractAction(LangTool.getString("popup.copy")) {               public void actionPerformed(ActionEvent e) {                  screen.copyMe();                  getFocusForMe();               }           };         popup.add(createMenuItem(action,MNEMONIC_COPY));         action = new AbstractAction(LangTool.getString("popup.paste")) {               public void actionPerformed(ActionEvent e) {                  screen.sendKeys(MNEMONIC_PASTE);                  getFocusForMe();               }           };         popup.add(createMenuItem(action,MNEMONIC_PASTE));         action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) {               public void actionPerformed(ActionEvent e) {                  screen.pasteMe(true);                  getFocusForMe();               }           };         popup.add(action);         Rectangle workR = new Rectangle();         if (rubberband.isAreaSelected()) {            // get the bounded area of the selection            screen.getBoundingArea(workR);            popup.addSeparator();            menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns")                              + " " + workR.width);            menuItem.setArmed(false);            popup.add(menuItem);            menuItem = new JMenuItem(LangTool.getString("popup.selectedRows")                              + " " + workR.height);            menuItem.setArmed(false);            popup.add(menuItem);            JMenu sumMenu = new JMenu(LangTool.getString("popup.calc"));            popup.add(sumMenu);            action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) {               public void actionPerformed(ActionEvent e) {                  sumArea(true);               }            };            sumMenu.add(action);            action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) {               public void actionPerformed(ActionEvent e) {                  sumArea(false);               }            };            sumMenu.add(action);         }         popup.addSeparator();         action = new AbstractAction(LangTool.getString("popup.printScreen")) {               public void actionPerformed(ActionEvent e) {                  screen.printMe();                  getFocusForMe();               }           };         popup.add(createMenuItem(action,MNEMONIC_PRINT_SCREEN));         popup.addSeparator();         JMenu kbMenu = new JMenu(LangTool.getString("popup.keyboard"));         popup.add(kbMenu);         action = new AbstractAction(LangTool.getString("popup.mapKeys")) {               public void actionPerformed(ActionEvent e) {                  mapMeKeys();               }           };         kbMenu.add(action);         kbMenu.addSeparator();         action = new AbstractAction(LangTool.getString("key.[attn]")) {               public void actionPerformed(ActionEvent e) {                  screen.sendKeys("[attn]");               }           };         kbMenu.add(createMenuItem(action,MNEMONIC_ATTN));         action = new AbstractAction(LangTool.getString("key.[reset]")) {               public void actionPerformed(ActionEvent e) {                  screen.sendKeys("[reset]");               }           };         kbMenu.add(createMenuItem(action,MNEMONIC_RESET));         action = new AbstractAction(LangTool.getString("key.[sysreq]")) {               public void actionPerformed(ActionEvent e) {                  screen.sendKeys("[sysreq]");               }           };         kbMenu.add(createMenuItem(action,MNEMONIC_SYSREQ));         if (screen.isMessageWait()) {            action = new AbstractAction(LangTool.getString("popup.displayMessages")) {                  public void actionPerformed(ActionEvent e) {                     vt.systemRequest('4');                  }              };            kbMenu.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES));         }         kbMenu.addSeparator();         action = new AbstractAction(LangTool.getString("key.[dupfield]")) {               public void actionPerformed(ActionEvent e) {                  screen.sendKeys("[dupfield]");               }           };         kbMenu.add(createMenuItem(action,MNEMONIC_DUP_FIELD));         action = new AbstractAction(LangTool.getString("key.[help]")) {               public void actionPerformed(ActionEvent e) {                  screen.sendKeys("[help]");               }           };         kbMenu.add(createMenuItem(action,MNEMONIC_HELP));         action = new AbstractAction(LangTool.getString("key.[eraseeof]")) {               public void actionPerformed(ActionEvent e) {                  screen.sendKeys("[eraseeof]");               }           };         kbMenu.add(createMenuItem(action,MNEMONIC_ERASE_EOF));         action = new AbstractAction(LangTool.getString("key.[field+]")) {               public void actionPerformed(ActionEvent e) {                  screen.sendKeys("[field+]");               }           };         kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_PLUS));         action = new AbstractAction(LangTool.getString("key.[field-]")) {               public void actionPerformed(ActionEvent e) {                  screen.sendKeys("[field-]");               }           };         kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_MINUS));         action = new AbstractAction(LangTool.getString("key.[newline]")) {               public void actionPerformed(ActionEvent e) {                  screen.sendKeys("[newline]");               }           };         kbMenu.add(createMenuItem(action,MNEMONIC_NEW_LINE));         action = new AbstractAction(LangTool.getString("popup.hostPrint")) {               public void actionPerformed(ActionEvent e) {                  vt.hostPrint(1);               }           };         kbMenu.add(createMenuItem(action,MNEMONIC_PRINT));         createShortCutItems(kbMenu);         if (screen.isMessageWait()) {            action = new AbstractAction(LangTool.getString("popup.displayMessages")) {                  public void actionPerformed(ActionEvent e) {                     vt.systemRequest('4');                  }              };            popup.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES));         }         popup.addSeparator();         action = new AbstractAction(LangTool.getString("popup.hexMap")) {               public void actionPerformed(ActionEvent e) {                  showHexMap();                  getFocusForMe();               }           };         popup.add(createMenuItem(action,""));         action = new AbstractAction(LangTool.getString("popup.mapKeys")) {               public void actionPerformed(ActionEvent e) {                  mapMeKeys();                  getFocusForMe();               }           };         popup.add(createMenuItem(action,""));         action = new AbstractAction(LangTool.getString("popup.settings")) {               public void actionPerformed(ActionEvent e) {                  doAttributes();                  getFocusForMe();               }           };         popup.add(createMenuItem(action,MNEMONIC_DISP_ATTRIBUTES));         popup.addSeparator();         if (isMacroRunning()) {            action = new AbstractAction(LangTool.getString("popup.stopScript")) {                  public void actionPerformed(ActionEvent e) {                     setStopMacroRequested();                  }              };            popup.add(action);         }         else {            JMenu macMenu = new JMenu(LangTool.getString("popup.macros"));            if (keyHandler.isRecording()) {               action = new AbstractAction(LangTool.getString("popup.stop")) {                     public void actionPerformed(ActionEvent e) {                        stopRecordingMe();                        getFocusForMe();                     }               };            }            else {               action = new AbstractAction(LangTool.getString("popup.record")) {                     public void actionPerformed(ActionEvent e) {                        startRecordingMe();                        getFocusForMe();                     }               };            }            macMenu.add(action);            if (Macronizer.isMacrosExist()) {               // this will add a sorted list of the macros to the macro menu               addMacros(macMenu);            }            popup.add(macMenu);         }         popup.addSeparator();         JMenu xtfrMenu = new JMenu(LangTool.getString("popup.export"));         action = new AbstractAction(LangTool.getString("popup.xtfrFile")) {               public void actionPerformed(ActionEvent e) {                  doMeTransfer();                  getFocusForMe();               }           };         xtfrMenu.add(createMenuItem(action,MNEMONIC_FILE_TRANSFER));         action = new AbstractAction(LangTool.getString("popup.xtfrSpool")) {               public void actionPerformed(ActionEvent e) {                  doMeSpool();                  getFocusForMe();               }           };         xtfrMenu.add(action);         popup.add(xtfrMenu);         JMenu sendMenu = new JMenu(LangTool.getString("popup.send"));         popup.add(sendMenu);         action = new AbstractAction(LangTool.getString("popup.email")) {               public void actionPerformed(ActionEvent e) {                  sendScreenEMail();                  getFocusForMe();               }           };         sendMenu.add(createMenuItem(action,MNEMONIC_E_MAIL));         action = new AbstractAction(LangTool.getString("popup.file")) {               public void actionPerformed(ActionEvent e) {                  sendMeToFile();               }           };         sendMenu.add(action);         popup.addSeparator();      }      action = new AbstractAction(LangTool.getString("popup.connections")) {            public void actionPerformed(ActionEvent e) {               doConnections();            }        };      popup.add(createMenuItem(action,MNEMONIC_OPEN_NEW));      popup.addSeparator();      if (vt.isConnected()) {         action = new AbstractAction(LangTool.getString("popup.disconnect")) {               public void actionPerformed(ActionEvent e) {                  changeConnection();                  getFocusForMe();               }           };      }      else {         action = new AbstractAction(LangTool.getString("popup.connect")) {               public void actionPerformed(ActionEvent e) {                  changeConnection();                  getFocusForMe();               }           };      }      popup.add(createMenuItem(action,MNEMONIC_TOGGLE_CONNECTION));      action = new AbstractAction(LangTool.getString("popup.close")) {            public void actionPerformed(ActionEvent e) {               closeSession();            }        };      popup.add(createMenuItem(action,MNEMONIC_CLOSE));      GUIGraphicsUtils.positionPopup(me.getComponent(),popup,               me.getX(),me.getY());   }