コード例 #1
4
 /** Listener to handle button actions */
 public void actionPerformed(ActionEvent e) {
   // Check if the user changed the service filter option
   if (e.getSource() == service_box) {
     service_list.setEnabled(service_box.isSelected());
     service_list.clearSelection();
     remove_service_button.setEnabled(false);
     add_service_field.setEnabled(service_box.isSelected());
     add_service_field.setText("");
     add_service_button.setEnabled(false);
   }
   // Check if the user pressed the add service button
   if ((e.getSource() == add_service_button) || (e.getSource() == add_service_field)) {
     String text = add_service_field.getText();
     if ((text != null) && (text.length() > 0)) {
       service_data.addElement(text);
       service_list.setListData(service_data);
     }
     add_service_field.setText("");
     add_service_field.requestFocus();
   }
   // Check if the user pressed the remove service button
   if (e.getSource() == remove_service_button) {
     Object[] sels = service_list.getSelectedValues();
     for (int i = 0; i < sels.length; i++) {
       service_data.removeElement(sels[i]);
     }
     service_list.setListData(service_data);
     service_list.clearSelection();
   }
 }
コード例 #2
0
    public void actionPerformed(ActionEvent evt) {
      if (evt.getSource() != null) {

        // Commented by Balan on 15/03/03
        // TreeNode selectedTreeNode = findNode((DefaultMutableTreeNode)frame.model.getRoot() , ((
        // (TreeCombo)evt.getSource() ).getSelectedNode()).toString() );
        // Comment Ends

        // Added by Balan on 15/03/03

        Object tempObject =
            ((DefaultMutableTreeNode) ((TreeCombo) evt.getSource()).getSelectedNode())
                .getUserObject();
        String strMatchNode = "" + ((Hashtable) tempObject).get("TREE-NAME");
        TreeNode selectedTreeNode =
            findNode((DefaultMutableTreeNode) frame.model.getRoot(), strMatchNode);

        // Add Ends

        if (selectedTreeNode != null) {
          fromCombo = true;
          TreeNode tempNode[] = frame.model.getPathToRoot(selectedTreeNode);
          frame.JTree1.setSelectionPath(new TreePath(tempNode));
        } else {
          // This case should n't occur
        }
      }
    }
コード例 #3
0
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == ctl) {
     this.menu();
   } else if (e.getSource() == exit) {
     exitPerform();
   } else if (e.getSource() == rank) {
     if (count != 0) {
       card.show(mainPanel, "four");
       rankPanel.setMemory(memory, count - 1);
       buttonPanel.removeAll();
       buttonPanel.setBounds(width - 200, height - 80, 190, 50);
       buttonPanel.add(exit);
       check = 4;
       count--;
     }
   } else if (e.getSource() == back) {
     if (secondPanel.clip != null) {
       secondPanel.clip.stop();
       System.out.printf("test");
     }
     check = 0;
     card.previous(mainPanel);
     buttonPanel.removeAll();
     ctl.setText("- Play -");
     buttonPanel.add(ctl);
     buttonPanel.add(rank);
     buttonPanel.add(exit);
     buttonPanel.setOpaque(false);
     buttonPanel.setBounds(width / 2 - 50, height / 2 - 50, 80, 100);
   }
 }
コード例 #4
0
ファイル: SecurityPanel.java プロジェクト: richardwhiuk/jitsi
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == enableDefaultEncryption) {
     loadStates();
   } else if (e.getSource() == cmdExpandAdvancedSettings) {
     pnlAdvancedSettings.setVisible(!pnlAdvancedSettings.isVisible());
   }
 }
コード例 #5
0
ファイル: ImageJ.java プロジェクト: chrisp87/ImageJA
 /** Handle menu events. */
 public void actionPerformed(ActionEvent e) {
   if ((e.getSource() instanceof MenuItem)) {
     MenuItem item = (MenuItem) e.getSource();
     String cmd = e.getActionCommand();
     commandName = cmd;
     ImagePlus imp = null;
     if (item.getParent() == Menus.getOpenRecentMenu()) {
       new RecentOpener(cmd); // open image in separate thread
       return;
     } else if (item.getParent() == Menus.getPopupMenu()) {
       Object parent = Menus.getPopupMenu().getParent();
       if (parent instanceof ImageCanvas) imp = ((ImageCanvas) parent).getImage();
     }
     int flags = e.getModifiers();
     hotkey = false;
     actionPerformedTime = System.currentTimeMillis();
     long ellapsedTime = actionPerformedTime - keyPressedTime;
     if (cmd != null && (ellapsedTime >= 200L || !cmd.equals(lastKeyCommand))) {
       if ((flags & Event.ALT_MASK) != 0) IJ.setKeyDown(KeyEvent.VK_ALT);
       if ((flags & Event.SHIFT_MASK) != 0) IJ.setKeyDown(KeyEvent.VK_SHIFT);
       new Executer(cmd, imp);
     }
     lastKeyCommand = null;
     if (IJ.debugMode) IJ.log("actionPerformed: time=" + ellapsedTime + ", " + e);
   }
 }
コード例 #6
0
 /** Listener to handle button actions */
 public void actionPerformed(ActionEvent e) {
   // Check if the user pressed the ok button
   if (e.getSource() == ok_button) {
     filter_include_list = include_panel.getServiceList();
     filter_exclude_list = exclude_panel.getServiceList();
     if (status_box.isSelected()) {
       filter_active = status_active.isSelected();
       filter_complete = status_complete.isSelected();
     } else {
       filter_active = false;
       filter_complete = false;
     }
     ok_pressed = true;
     dialog.dispose();
   }
   // Check if the user pressed the cancel button
   if (e.getSource() == cancel_button) {
     dialog.dispose();
   }
   // Check if the user changed the status filter option
   if (e.getSource() == status_box) {
     status_active.setEnabled(status_box.isSelected());
     status_complete.setEnabled(status_box.isSelected());
   }
 }
コード例 #7
0
  @Override
  public void actionPerformed(ActionEvent e) {

    if (e.getSource() == salir) {
      JOptionPane.showMessageDialog(null, "Pantalla de Marlon");
    }

    if (e.getSource() == opc1) {
      JOptionPane.showMessageDialog(null, "Respuesta Incorrecta");
      Pregunta14 avance = new Pregunta14(s);
      dispose();
    }

    if (e.getSource() == opc2) {
      score = s + 10;
      JOptionPane.showMessageDialog(null, "Respuesta Correcta :0 ");
      Pregunta14 avance = new Pregunta14(score);
      dispose();
    }

    if (e.getSource() == opc3) {
      JOptionPane.showMessageDialog(null, "Respuesta Incorrecta");
      Pregunta14 avance = new Pregunta14(s);
      dispose();
    }

    if (e.getSource() == opc4) {
      JOptionPane.showMessageDialog(null, "Respuesta Incorrecta");
      Pregunta14 avance = new Pregunta14(s);
      dispose();
    }
  }
コード例 #8
0
  /*.................................................................................................................*/
  public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equalsIgnoreCase("setToDefaults")) {
      setDefaultTNTCommandsSearchOptions();
      searchField.setText(searchArguments);
      bootstrapSearchField.setText(bootstrapSearchArguments);
      harvestOnlyStrictConsensusBox.setState(harvestOnlyStrictConsensus);
      resamplingAllConsensusTreesBox.setState(!resamplingAllConsensusTrees);
      bootStrapRepsField.setValue(bootstrapreps);

    } else if (e.getActionCommand().equalsIgnoreCase("setToDefaultsOtherOptions")) {
      setDefaultTNTCommandsOtherOptions();
      otherOptionsField.setText(otherOptions);
      convertGapsBox.setState(convertGapsToMissing);
    } else if (e.getActionCommand().equalsIgnoreCase("browseSearchScript")
        && searchScriptPathField != null) {
      MesquiteString directoryName = new MesquiteString();
      MesquiteString fileName = new MesquiteString();
      String path =
          MesquiteFile.openFileDialog("Choose Search Script File", directoryName, fileName);
      if (StringUtil.notEmpty(path)) searchScriptPathField.setText(path);
    } else if (e.getActionCommand().equalsIgnoreCase("browseBootSearchScript")
        && bootSearchScriptPathField != null) {

      MesquiteString directoryName = new MesquiteString();
      MesquiteString fileName = new MesquiteString();
      String path =
          MesquiteFile.openFileDialog(
              "Choose Resampling Search Script File", directoryName, fileName);
      if (StringUtil.notEmpty(path)) bootSearchScriptPathField.setText(path);
    }
  }
コード例 #9
0
    @Override
    public void actionPerformed(ActionEvent e) {
      if (e.getSource() == add) {
        // int sel = userTable.getSelectedRow();
        // if (sel < 0)
        //    sel = 0;

        nameTf.setText("");
        abbrTf.setText("");
        if (JOptionPane.showConfirmDialog(
                dialog,
                journalEditPanel,
                Localization.lang("Edit journal"),
                JOptionPane.OK_CANCEL_OPTION)
            == JOptionPane.OK_OPTION) {
          journals.add(new JournalEntry(nameTf.getText(), abbrTf.getText()));
          // setValueAt(nameTf.getText(), sel, 0);
          // setValueAt(abbrTf.getText(), sel, 1);
          Collections.sort(journals);
          fireTableDataChanged();
        }
      } else if (e.getSource() == remove) {
        int[] rows = userTable.getSelectedRows();
        if (rows.length > 0) {
          for (int i = rows.length - 1; i >= 0; i--) {
            journals.remove(rows[i]);
          }
          fireTableDataChanged();
        }
      }
    }
コード例 #10
0
 /**
  * * Each non abstract class that implements the ActionListener must have this method.
  *
  * @param e the action event.
  */
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == dumpButton) {
     String password = askForAdminPassword();
     if (password == null) {
       return;
     }
     String[] yw = queryMostRecentOrderYearAndWeek();
     String year = yw[0];
     String week = String.format("%02d", Integer.parseInt(yw[1]));
     initializeSaveChooser("DB_Dump_" + year + "_KW" + week + ".sql");
     String filename = askForDumpFilename();
     if (filename != null) {
       dumpDatabase(password, filename);
     }
     return;
   }
   if (e.getSource() == readButton) {
     String password = askForAdminPassword();
     if (password == null) {
       return;
     }
     initializeLoadChooser();
     String filename = askForReadFilename();
     if (filename != null) {
       readDatabase(password, filename);
       // update all tabs
       tabbedPane.recreateTabbedPane();
     }
   }
 }
コード例 #11
0
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == jb1) {
     try {
       strategyFrame =
           new StrategyFrame(
               trainingTeaBLService.showFrameStrategy(), trainingTeaBLService, jb1.getText());
       strategyFrame.setTrainingTeaWindow(this.trainingTeaWindow);
     } catch (RemoteException e1) {
       // TODO Auto-generated catch block
       e1.printStackTrace();
     }
   } else if (e.getSource() == jb2) {
     try {
       strategyFrame =
           new StrategyFrame(
               trainingTeaBLService.showFrameStrategy(), trainingTeaBLService, jb2.getText());
       strategyFrame.setTrainingTeaWindow(this.trainingTeaWindow);
     } catch (RemoteException e1) {
       // TODO Auto-generated catch block
       e1.printStackTrace();
     }
   } else if (e.getSource() == refresh) {
     refresh();
   }
 }
コード例 #12
0
  /**
   * Closes dialog box when the OK button is pressed, sets variables and calls algorithm.
   *
   * @param event Event that triggers function.
   */
  public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    Object source = event.getSource();

    if (command.equals("OK")) {

      if (setVariables()) {
        callAlgorithm();
      }
    } else if (command.equals("Cancel")) {
      dispose();
    } else if (command.equals("Help")) {
      // MipavUtil.showHelp("");
    } else if (source.equals(doRicianCheckBox)) {
      if (doRicianCheckBox.isSelected()) {
        labelDegree.setEnabled(true);
        textDegree.setEnabled(true);
      } else {
        labelDegree.setEnabled(false);
        textDegree.setEnabled(false);
      }
    } else { // else if (source == thresholdCheckbox)
      super.actionPerformed(event);
    }
  }
コード例 #13
0
ファイル: ControlPanel.java プロジェクト: johnperry/Geneva2
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() instanceof JMenuItem) {
     JMenuItem item = (JMenuItem) e.getSource();
     String name = item.getText();
     profiles.delete(name);
   }
 }
コード例 #14
0
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == top) {
     tabbedpane.setTabPlacement(JTabbedPane.TOP);
   } else if (e.getSource() == left) {
     tabbedpane.setTabPlacement(JTabbedPane.LEFT);
   } else if (e.getSource() == bottom) {
     tabbedpane.setTabPlacement(JTabbedPane.BOTTOM);
   } else if (e.getSource() == right) {
     tabbedpane.setTabPlacement(JTabbedPane.RIGHT);
   }
 }
コード例 #15
0
  public void actionPerformed(ActionEvent ae) {
    if (ae.getSource() instanceof JMenuItem) {
      JMenuItem src = (JMenuItem) ae.getSource();

      if (src.getName().equals("exit")) {
        cleanExit();
        return;
      }

      runPlugin(src.getName());
    } else runPlugin(MAIN_INTERFACE);
  }
コード例 #16
0
ファイル: ExcelAdapter.java プロジェクト: rajarshi/saliviewer
 /**
  * This method is activated on the Keystrokes we are listening to in this implementation. Here it
  * listens for Copy and Paste ActionCommands. Selections comprising non-adjacent cells result in
  * invalid selection and then copy action cannot be performed. Paste is done by aligning the upper
  * left corner of the selection with the 1st element in the current selection of the JTable.
  */
 public void actionPerformed(ActionEvent e) {
   if (e.getActionCommand().compareTo("Copy") == 0) {
     StringBuffer sbf = new StringBuffer();
     // Check to ensure we have selected only a contiguous block of
     // cells
     int numcols = jTable1.getSelectedColumnCount();
     int numrows = jTable1.getSelectedRowCount();
     int[] rowsselected = jTable1.getSelectedRows();
     int[] colsselected = jTable1.getSelectedColumns();
     if (!((numrows - 1 == rowsselected[rowsselected.length - 1] - rowsselected[0]
             && numrows == rowsselected.length)
         && (numcols - 1 == colsselected[colsselected.length - 1] - colsselected[0]
             && numcols == colsselected.length))) {
       JOptionPane.showMessageDialog(
           null, "Invalid Copy Selection", "Invalid Copy Selection", JOptionPane.ERROR_MESSAGE);
       return;
     }
     for (int i = 0; i < numrows; i++) {
       for (int j = 0; j < numcols; j++) {
         sbf.append(jTable1.getValueAt(rowsselected[i], colsselected[j]));
         if (j < numcols - 1) sbf.append("\t");
       }
       sbf.append("\n");
     }
     stsel = new StringSelection(sbf.toString());
     system = Toolkit.getDefaultToolkit().getSystemClipboard();
     system.setContents(stsel, stsel);
   }
   if (e.getActionCommand().compareTo("Paste") == 0) {
     System.out.println("Trying to Paste");
     int startRow = (jTable1.getSelectedRows())[0];
     int startCol = (jTable1.getSelectedColumns())[0];
     try {
       String trstring =
           (String) (system.getContents(this).getTransferData(DataFlavor.stringFlavor));
       System.out.println("String is:" + trstring);
       StringTokenizer st1 = new StringTokenizer(trstring, "\n");
       for (int i = 0; st1.hasMoreTokens(); i++) {
         rowstring = st1.nextToken();
         StringTokenizer st2 = new StringTokenizer(rowstring, "\t");
         for (int j = 0; st2.hasMoreTokens(); j++) {
           value = (String) st2.nextToken();
           if (startRow + i < jTable1.getRowCount() && startCol + j < jTable1.getColumnCount())
             jTable1.setValueAt(value, startRow + i, startCol + j);
           System.out.println(
               "Putting " + value + "at row = " + startRow + i + "column = " + startCol + j);
         }
       }
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   }
 }
コード例 #17
0
ファイル: OwnerDialog.java プロジェクト: siwells/monkeypuzzle
 public void actionPerformed(ActionEvent event) {
   if (event.getSource() == okButton) {
     this.setVisible(false);
   } else if (event.getSource() == rightArrow) {
     try {
       araucaria
           .getArgument()
           .addOwnersToSelected(araucaria, ownerSourceTableModel.getSelectedOwners());
       ownerNodesTableModel.updateTable(araucaria.getArgument().getSelectedVertexOwners());
       araucaria.undoStack.push(new EditAction(araucaria, "adding owners"));
     } catch (Exception ex) {
       return;
     }
   } else if (event.getSource() == leftArrow) {
     // Delete owners only from selected vertices
     araucaria.getArgument().deleteOwners(ownerNodesTableModel.getSelectedOwners(), true);
     ownerNodesTableModel.updateTable(araucaria.getArgument().getSelectedVertexOwners());
     araucaria.undoStack.push(new EditAction(araucaria, "removing owners"));
   } else if (event.getSource() == addOwnerButton) {
     String newOwnerName = ownerText.getText();
     if (newOwnerName.length() == 0) {
       return;
     }
     ownerSourceTableModel.addOwner(newOwnerName);
     ownerText.setText("");
     ownerText.requestFocus();
   } else if (event.getSource() == deleteSourceButton) {
     Vector selected = null;
     try {
       selected = ownerSourceTableModel.getSelectedOwners();
     } catch (Exception ex) {
       return;
     }
     if (selected == null || selected.size() == 0) return;
     int action =
         JOptionPane.showConfirmDialog(
             this,
             "<html><center><font color=red face=helvetica><b>Delete selected owners?</b></font></center></html>",
             "Delete owners?",
             JOptionPane.YES_NO_OPTION,
             JOptionPane.WARNING_MESSAGE,
             null);
     if (action == 1) return;
     araucaria.getArgument().deleteOwners(selected);
     // Delete owners from ALL vertices
     araucaria.getArgument().deleteOwners(selected, false);
     ownerSourceTableModel.updateTable(araucaria.getArgument().getOwnerList());
     ownerNodesTableModel.updateTable(araucaria.getArgument().getSelectedVertexOwners());
   }
 }
コード例 #18
0
ファイル: JCTimePanel.java プロジェクト: esprayer/EMPPlatform
 /**
  * Invoked when an action occurs.
  *
  * @param e ActionEvent
  * @todo Implement this java.awt.event.ActionListener method
  */
 public void actionPerformed(ActionEvent e) {
   try {
     setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
     if (e.getSource() == addButton) {
       processAddEvent();
     } else if (e.getSource() == editButton) {
       processEditEvent();
     } else if (e.getSource() == delButton) {
       processDeleteEvent();
     }
     processTaskTable();
   } finally {
     setCursor(Cursor.getDefaultCursor());
   }
 }
コード例 #19
0
ファイル: Decipher.java プロジェクト: johnperry/MIRC1
 /**
  * The ActionListener implementation
  *
  * @param event the event.
  */
 public void actionPerformed(ActionEvent event) {
   String searchText = textField.getText().trim();
   if (searchText.equals("") && !saveAs.isSelected() && (fileLength > 10000000)) {
     textPane.setText("Blank search text is not allowed for large IdTables.");
   } else {
     File outputFile = null;
     if (saveAs.isSelected()) {
       outputFile = chooser.getSelectedFile();
       if (outputFile != null) {
         String name = outputFile.getName();
         int k = name.lastIndexOf(".");
         if (k != -1) name = name.substring(0, k);
         name += ".txt";
         File parent = outputFile.getAbsoluteFile().getParentFile();
         outputFile = new File(parent, name);
         chooser.setSelectedFile(outputFile);
       }
       if (chooser.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) System.exit(0);
       outputFile = chooser.getSelectedFile();
     }
     textPane.setText("");
     Searcher searcher = new Searcher(searchText, event.getSource().equals(searchPHI), outputFile);
     searcher.start();
   }
 }
コード例 #20
0
  public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();

    if (source == popper) {
      showMenu();
    }
  }
  public void actionPerformed(ActionEvent evt) {
    // Get button clicked
    JButton buttonClicked = (JButton) evt.getSource();
    String actionCommand = new String(buttonClicked.getActionCommand());

    if (actionCommand.equals("Submit")) {
      System.out.println(clientUser.getLogon() + ": updating ticket...");

      // Recover ticket and update it
      Ticket ticketToUpdate = ticket;
      ticketToUpdate.setDesc(clientTicketDialog.getSummaryDescriptionField());
      ticketToUpdate.setResolution(clientTicketDialog.getResolutionDescriptionField());

      // Call checkInTicket() on the RMI object to update the ticket on the server
      try {
        ticketServerObject.checkInTicket(ticketToUpdate);
        // Refresh the activeTickets HashMap
        owner.getActiveTickets();
      } catch (RemoteException re) {
        System.out.println(re.getMessage());
      }

      // Close the ClientTicketDialog
      clientTicketDialog.setVisible(false);
      clientTicketDialog.dispose();
    }
  }
コード例 #22
0
  public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();

    if (cmd.equals("ok")) System.out.println("do ok");
    else if (cmd.equals("cancel")) this.setVisible(false);
    else if (cmd.equals("help")) displayHelp();
  }
コード例 #23
0
ファイル: MessagePan.java プロジェクト: UlTMATE/Lookout
  @Override
  public void actionPerformed(ActionEvent axnEve) {
    Object obj = axnEve.getSource();
    if (obj == replyBut) {
      try {
        if (Home.composeDial != null && Home.composeDial.isShowing()) {

        } else {
          Home.composeDial =
              new ComposeMailDialog(
                  msgID, workingSet.getString("mail_addresses"), workingSet.getString("subject"));
        }
      } catch (SQLException sqlExc) {
        sqlExc.printStackTrace();
      }
    } else if (obj == forwardBut) {
      try {
        if (Home.composeDial != null && Home.composeDial.isShowing()) {

        } else {
          Home.composeDial =
              new ComposeMailDialog(
                  msgID,
                  workingSet.getString("subject") + "\n\n" + workingSet.getString("content"));
        }
      } catch (SQLException sqlExc) {
        sqlExc.printStackTrace();
      }
    }
  }
コード例 #24
0
ファイル: HyperSearchResults.java プロジェクト: SELab/jEdit
    @Override
    public void actionPerformed(ActionEvent evt) {
      JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) evt.getSource();
      boolean curState = menuItem.isSelected();

      TreePath path = resultTree.getSelectionPath();
      DefaultMutableTreeNode operNode = (DefaultMutableTreeNode) path.getLastPathComponent();

      HyperSearchOperationNode operNodeObj = (HyperSearchOperationNode) operNode.getUserObject();
      if (curState) operNodeObj.cacheResultNodes(operNode);
      operNode.removeAllChildren();
      if (curState) {
        Exception excp = null;
        try {
          operNodeObj.insertTreeNodes(resultTree, operNode);
        } catch (Exception ex) {
          operNodeObj.restoreFlatNodes(resultTree, operNode);
          menuItem.setSelected(false);
          excp = ex;
        } finally {
          ((DefaultTreeModel) resultTree.getModel()).nodeStructureChanged(operNode);
          expandAllNodes(operNode);
          resultTree.scrollPathToVisible(new TreePath(operNode.getPath()));
        }
        if (excp != null) throw new RuntimeException(excp);
      } else operNodeObj.restoreFlatNodes(resultTree, operNode);

      operNodeObj.setTreeViewDisplayed(menuItem.isSelected());
    }
コード例 #25
0
  public void actionPerformed(ActionEvent event) {
    JMenuItem source = (JMenuItem) (event.getSource());

    for (GraphView v : gp.getGraphViewList()) {
      if (v.getMenuText().equals(source.getText())) {
        v.view();
        repaint();
        return;
      }
    }

    for (GraphDrawer d : gp.getGraphDrawerList()) {
      if (d.getMenuText().equals(source.getText())) {
        d.layout();
        repaint();
        return;
      }
    }

    for (GraphUtility u : gp.getGraphUtilityList()) {
      if (u.getMenuText().equals(source.getText())) {
        u.apply();
        repaint();
        return;
      }
    }

    for (GraphExperiment ge : gp.getGraphExperimentList()) {
      if (ge.getMenuText().equals(source.getText())) {
        ge.experiment();
        repaint();
        return;
      }
    }
  }
コード例 #26
0
  public void actionPerformed(ActionEvent evt) {
    Object src = evt.getSource();

    try {
      if (src == propDialog) {
        propDialog_actionPerformed(evt);
      } else {
        pdu = new BlockPdu(context);
        if (src == setButton) {
          pdu.setPduType(BlockPdu.SET);
          pdu.addOid(toid.getText(), new AsnOctets(tvalue.getText()));
        } else if (src == getButton) {
          pdu.setPduType(BlockPdu.GET);
          pdu.addOid(toid.getText());
        } else if (src == getNextButton) {
          pdu.setPduType(BlockPdu.GETNEXT);
          pdu.addOid(toid.getText());
        }
        sendRequest(pdu);
      }
    } catch (Exception exc) {
      exc.printStackTrace();
      lmessage.setText("Exception: " + exc.getMessage());
      lmessage.setBackground(Color.red);
    }
  }
コード例 #27
0
 public void actionPerformed(ActionEvent ae) {
   String action = ae.getActionCommand();
   if (action.equals("refresh")) {
     routerThread = new Thread(this);
     routerThread.start();
   }
 }
コード例 #28
0
    public void actionPerformed(ActionEvent e) {
      JGrid grid = (JGrid) e.getSource();
      SelectionModel sm = grid.getSelectionModel();
      anchorRow = sm.getAnchorRow();
      leadRow = sm.getLeadRow();
      anchorColumn = sm.getAnchorColumn();
      leadColumn = sm.getLeadColumn();

      int oldAnchorRow = anchorRow;
      int oldAnchorColumn = anchorColumn;

      if (grid.isEditing() && !grid.getCurrentCellEditor().stopCellEditing()) {
        return;
      }

      if (!inSelection) {
        moveWithinGridRange(grid, dx, dy, extend);
        if (!extend) {
          grid.changeSelection(anchorRow, anchorColumn, false, extend);
        } else {
          grid.changeSelection(leadRow, leadColumn, false, extend);
        }
      } else {
        if (moveWithinSelectedRange(grid, dx, dy, false)) {
          grid.changeSelection(anchorRow, anchorColumn, true, true);
        } else {
          grid.changeSelection(anchorRow, anchorColumn, false, false);
        }
      }
    }
コード例 #29
0
ファイル: Memory.java プロジェクト: mattec92/KTH
 // Action - vad som händer om man klickar på knappen
 public void actionPerformed(ActionEvent e) {
   // Om man trycker på Avslutaknappen
   if (e.getSource() == exit) {
     // Stänger ner scorelistan och avslutar spelet
     System.exit(0);
   }
 }
コード例 #30
0
  public void actionPerformed(ActionEvent evt) {
    String arg = evt.getActionCommand();

    if (arg.equals("Ok")) {
      dispose();
    }
  }