action = new AbstractAction(LangTool.getString("popup.systemRequest")) { public void actionPerformed(ActionEvent e) { vt.systemRequest(); } }; popup.add(action);  action = new AbstractAction(LangTool.getString("popup.help")) { public void actionPerformed(ActionEvent e) { vt.sendHelpRequest(); } }; popup.add(action);
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(action);  action = new AbstractAction(LangTool.getString("key.[reset]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[reset]"); } }; kbMenu.add(action);  action = new AbstractAction(LangTool.getString("key.[sysreq]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[sysreq]"); } }; kbMenu.add(action);  if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; kbMenu.add(action); }  kbMenu.addSeparator();  action = new AbstractAction(LangTool.getString("key.[dupfield]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[dupfield]"); } }; kbMenu.add(action);  action = new AbstractAction(LangTool.getString("key.[help]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[help]"); } }; kbMenu.add(action);  action = new AbstractAction(LangTool.getString("key.[eraseeof]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[eraseeof]"); } }; kbMenu.add(action);  action = new AbstractAction(LangTool.getString("key.[field+]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field+]"); } }; kbMenu.add(action);  action = new AbstractAction(LangTool.getString("key.[field-]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field-]"); } }; kbMenu.add(action);  action = new AbstractAction(LangTool.getString("key.[newline]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[newline]"); } }; kbMenu.add(action);
   private void doPopup (MouseEvent me) {      JMenuItem menuItem;      Action action;      popup = new JPopupMenu();      final Gui5250 g = this;      final int pos = screen.getRowColFromPoint(me.getX(),me.getY()) -                     (screen.getCols()-1);      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(action);         action = new AbstractAction(LangTool.getString("popup.paste")) {               public void actionPerformed(ActionEvent e) {                  screen.pasteMe(false);                  getFocusForMe();               }           };         popup.add(action);         action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) {               public void actionPerformed(ActionEvent e) {                  screen.pasteMe(true);                  getFocusForMe();               }           };         popup.add(action);      }      else {         action = new AbstractAction(LangTool.getString("popup.copy")) {               public void actionPerformed(ActionEvent e) {                  screen.copyMe();                  getFocusForMe();               }           };         popup.add(action);         action = new AbstractAction(LangTool.getString("popup.paste")) {               public void actionPerformed(ActionEvent e) {                  screen.pasteMe(false);                  getFocusForMe();               }           };         popup.add(action);         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()) {            rubberband.getBoundingArea(workR);            // get the width and height            int ePos = screen.getRowColFromPoint(workR.width ,                                       workR.height );            popup.addSeparator();            menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns")                              + " " + screen.getCol(ePos));            menuItem.setArmed(false);            popup.add(menuItem);            menuItem = new JMenuItem(LangTool.getString("popup.selectedRows")                              + " " + screen.getRow(ePos));            menuItem.setArmed(false);            popup.add(menuItem);//            JMenu sumMenu = new JMenu(LangTool.getString("popup.macros"));            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(action);         popup.addSeparator();         action = new AbstractAction(LangTool.getString("popup.systemRequest")) {               public void actionPerformed(ActionEvent e) {                  vt.systemRequest();               }           };         popup.add(action);         action = new AbstractAction(LangTool.getString("popup.help")) {               public void actionPerformed(ActionEvent e) {                  vt.sendHelpRequest();               }           };         popup.add(action);         action = new AbstractAction(LangTool.getString("popup.hostPrint")) {               public void actionPerformed(ActionEvent e) {                  vt.hostPrint(1);               }           };         popup.add(action);         if (screen.isMessageWait()) {            action = new AbstractAction(LangTool.getString("popup.displayMessages")) {                  public void actionPerformed(ActionEvent e) {                     vt.systemRequest('4');                  }              };            popup.add(action);         }         popup.addSeparator();         action = new AbstractAction(LangTool.getString("popup.hexMap")) {               public void actionPerformed(ActionEvent e) {                  showHexMap();               }           };         popup.add(action);         action = new AbstractAction(LangTool.getString("popup.mapKeys")) {               public void actionPerformed(ActionEvent e) {                  mapMeKeys();               }           };         popup.add(action);         action = new AbstractAction(LangTool.getString("popup.settings")) {               public void actionPerformed(ActionEvent e) {                  doAttributes();               }           };         popup.add(action);         popup.addSeparator();         JMenu macMenu = new JMenu(LangTool.getString("popup.macros"));         if (recording) {            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();                  }            };         }         macMenu.add(action);         if (macros.isMacrosExist()) {            macMenu.addSeparator();            String[] macrosList = macros.getMacroList();            for (int x = 0; x < macrosList.length; x++) {               action = new AbstractAction(macrosList[x]) {                     public void actionPerformed(ActionEvent e) {                        executeMeMacro(e);                     }                 };               macMenu.add(action);            }         }         popup.add(macMenu);         popup.addSeparator();         action = new AbstractAction(LangTool.getString("popup.xtfrFile")) {               public void actionPerformed(ActionEvent e) {                  doMeTransfer();               }           };         popup.add(action);         JMenu sendMenu = new JMenu(LangTool.getString("popup.send"));         popup.add(sendMenu);         action = new AbstractAction(LangTool.getString("popup.email")) {               public void actionPerformed(ActionEvent e) {                  sendScreenEMail();               }           };         sendMenu.add(action);         action = new AbstractAction(LangTool.getString("popup.file")) {               public void actionPerformed(ActionEvent e) {                  sendMeToFile();               }           };         sendMenu.add(action);         popup.addSeparator();         if (vt.isConnected()) {            action = new AbstractAction(LangTool.getString("popup.disconnect")) {                  public void actionPerformed(ActionEvent e) {                     vt.disconnect();                     getFocusForMe();                  }              };         }         else {            action = new AbstractAction(LangTool.getString("popup.connect")) {                  public void actionPerformed(ActionEvent e) {                     vt.connect();                     getFocusForMe();                  }              };         }         popup.add(action);      }      action = new AbstractAction(LangTool.getString("popup.close")) {            public void actionPerformed(ActionEvent e) {               closeSession();            }        };      popup.add(action);      popup.show(me.getComponent(),               me.getX(),me.getY());   }