/** 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();
   }
 }
Example #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
        }
      }
    }
Example #3
0
 public void actionPerformed(ActionEvent event) {
   if (event.getSource() == bstart) {
     selectframe.setVisible(false);
     for (int i = 0; i < typeButtons.length; i++)
       if (typeButtons[i].isSelected()) {
         new Thread(this).start();
         return;
       }
   } else if (event.getSource() == bcancel) selectframe.setVisible(false);
   else if (event.getSource() == bopen) {
     int row = table.getSelectedRow();
     if (row != -1) {
       ResourceEntry resourceEntry = (ResourceEntry) table.getValueAt(row, 0);
       NearInfinity.getInstance().showResourceEntry(resourceEntry);
       ((AbstractStruct) NearInfinity.getInstance().getViewable())
           .getViewer()
           .selectEntry(((Item) table.getValueAt(row, 2)).getName());
     }
   } else if (event.getSource() == bopennew) {
     int row = table.getSelectedRow();
     if (row != -1) {
       ResourceEntry resourceEntry = (ResourceEntry) table.getValueAt(row, 0);
       Resource resource = ResourceFactory.getResource(resourceEntry);
       new ViewFrame(resultFrame, resource);
       ((AbstractStruct) resource)
           .getViewer()
           .selectEntry(((Item) table.getValueAt(row, 2)).getName());
     }
   }
 }
Example #4
0
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == enableDefaultEncryption) {
     loadStates();
   } else if (e.getSource() == cmdExpandAdvancedSettings) {
     pnlAdvancedSettings.setVisible(!pnlAdvancedSettings.isVisible());
   }
 }
Example #5
0
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() instanceof JMenuItem) {
     JMenuItem item = (JMenuItem) e.getSource();
     String name = item.getText();
     profiles.delete(name);
   }
 }
 /** 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());
   }
 }
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == this.jbGenerate) // 生成地圖代碼
    {
      String s = "public static final int[][] MAP=//0 可通過 1 不可通過\n{";
      for (int i = 0; i < mdp.row; i++) {
        s = s + "\n\t{";
        for (int j = 0; j < mdp.col; j++) {
          s = s + mdp.mapData[i][j] + ",";
        }
        s = s.substring(0, s.length() - 1) + "},";
      }
      s = s.substring(0, s.length() - 1) + "\n};";

      new CodeFrame(s, "3D重力球遊戲地圖");
    } else if (e.getSource() == this.jbGenerateD) { // 生成圓孔位置代碼
      String s = "public static final int[][] MAP_OBJECT=//表示可遇圓孔位置的矩陣\n{";

      for (int i = 0; i < mdp.row; i++) {
        s = s + "\n\t{";
        for (int j = 0; j < mdp.col; j++) {
          s = s + mdp.diamondMap[i][j] + ",";
        }
        s = s.substring(0, s.length() - 1) + "},"; // 去掉最後的逗號
      }
      s = s.substring(0, s.length() - 1) + "\n};";
      new CodeFrame(s, "圓孔分佈矩陣");
    }
  }
Example #8
0
    // implemented for ActionListener event handling
    public void actionPerformed(ActionEvent e) {
      String actionCmd = e.getActionCommand();
      Stack locStack = parentBrowserFrame.locationStack;
      Stack fwdStack = parentBrowserFrame.forwardStack;

      if (actionCmd.equals(homeCmd)) // event from home button
      {
        fwdStack.removeAllElements();
        parentBrowserFrame.setBrowserLocation(mainBrowserURL);
      } else if (actionCmd.equals(backCmd)) // event from back button
      {
        if (!locStack.isEmpty()) {
          String myLocale = (String) (locStack.pop());

          // push current location on forward stack
          fwdStack.push(location);
          getForwardButton().setEnabled(true);

          // do *not* cache the last location in the stack
          parentBrowserFrame.setBrowserLocation(myLocale, false);
        }
      } else if (actionCmd.equals(forwardCmd)) // event from forward button
      {
        if (!fwdStack.isEmpty()) {
          // remove location from forward stack
          String newLoc = (String) (fwdStack.pop());

          // DO add the current location to the back stack
          parentBrowserFrame.setBrowserLocation(newLoc);
        }
      } else if (actionCmd.equals(comboCmd)) // event from URL combo box!
      {
        if (e.getSource() instanceof JComboBox) // just to be sure
        {
          JComboBox thisBox = (JComboBox) e.getSource();

          String newLoc = thisBox.getSelectedItem().toString();
          if (newLoc != null && !newLoc.equals("")) // ignore empty selections
          {
            if (thisBox.getSelectedIndex() == -1) {
              thisBox.insertItemAt(newLoc, 0);
            }
            fwdStack.removeAllElements();
            parentBrowserFrame.setBrowserLocation(newLoc);
          }
        }
      }

      // disable the back button if we find the location stack is empty
      if (locStack.isEmpty()) {
        getBackButton().setEnabled(false);
      }

      // disable forward button if forward stack is empty
      if (fwdStack.isEmpty()) {
        getForwardButton().setEnabled(false);
      }
    }
 /**
  * Callback used to respond to button presses.
  *
  * @param e event capturing information about the button press.
  */
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == hButton) {
     game.setHorizontal(true);
   }
   if (e.getSource() == vButton) {
     game.setHorizontal(false);
   }
   updateStatus();
 }
 // Implementation of action performed
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == searchbutton) {
     update();
   } else if (e.getSource() == addfeesbutton) {
     addFees();
   } else if (e.getSource() == addcoursebutton) {
     addCourse();
   }
 }
 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);
   }
 }
Example #12
0
 public void actionPerformed(ActionEvent e) {
   int index = list.getSelectedIndex();
   if ("Move".equals(e.getActionCommand())) {
     copy = false;
     directoryList.getDirectory(index).copy = false;
   }
   if ("Copy".equals(e.getActionCommand())) {
     copy = true;
     directoryList.getDirectory(index).copy = true;
   }
 }
Example #13
0
 public void actionPerformed(ActionEvent e) {
   Object src = e.getSource();
   if (src == N) {
     /*setLayout(new GridLayout(2,2));
     size.width = 80;
     size.height = 20;*/
     dBar.setOrientation(DesktopBar.NORTH);
   }
   if (src == S) {
       /*
       setLayout(new GridLayout(2,2));
       size.width = 80;
       size.height = 20;*/
     dBar.setOrientation(DesktopBar.SOUTH);
   }
   if (src == E) {
       /*
       setLayout(new GridLayout(1,4));
       size.width = 80;
       size.height = 20;*/
     dBar.setOrientation(DesktopBar.EAST);
   }
   if (src == W) {
       /*
       setLayout(new GridLayout(1,4));
       size.width = 80;
       size.height = 20;*/
     dBar.setOrientation(DesktopBar.WEST);
   }
 }
    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);
        }
      }
    }
    public void actionPerformed(ActionEvent e) {
      if (getName() == CLOSE) {
        JOptionPane optionPane = (JOptionPane) e.getSource();

        optionPane.setValue(Integer.valueOf(JOptionPane.CLOSED_OPTION));
      }
    }
Example #16
0
 /**
  * Handle ui actions.
  *
  * @param event The action event
  */
 public void actionPerformed(ActionEvent event) {
   String action = event.getActionCommand();
   if (action.equals(GuiUtils.CMD_SAVE)) {
     doSave();
   } else if (action.equals(GuiUtils.CMD_SAVEAS)) {
     doSaveAs();
   } else if (action.equals(GuiUtils.CMD_RENAME)) {
     doRename();
   } else if (action.equals(GuiUtils.CMD_NEW)) {
     doNew();
   } else if (action.equals(GuiUtils.CMD_IMPORT)) {
     doImport();
   } else if (action.equals(GuiUtils.CMD_EXPORT)) {
     doExport();
   } else if (action.equals(GuiUtils.CMD_REMOVE)) {
     doRemove();
   } else if (action.equals(GuiUtils.CMD_CLOSE)) {
     doClose();
   } else if (action.equals(CMD_BLACKBG)) {
     setCanvasBackground(Color.BLACK);
   } else if (action.equals(CMD_WHITEBG)) {
     setCanvasBackground(Color.WHITE);
   } else {
     super.actionPerformed(event);
   }
 }
  public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();

    if (source == popper) {
      showMenu();
    }
  }
  public void actionPerformed(ActionEvent event) {
    Object source = event.getSource();
    if (boundedRangeModel != null) {
      int value = boundedRangeModel.getValue();
      if (source == forwardButton) {
        boundedRangeModel.setValue(
            value == boundedRangeModel.getMaximum() ? boundedRangeModel.getMinimum() : value + 1);
      } else if (source == rewindButton) {
        boundedRangeModel.setValue(
            value == boundedRangeModel.getMinimum() ? boundedRangeModel.getMaximum() : value - 1);
      } else if (source == startButton) {
        if (startButton.isSelected() != player.isActive()) {
          if (startButton.isSelected()) {
            player.start();
          } else {
            player.stop();
          }
        }
      } else if (source == audioButton) {

        player.setAudioEnabled(audioButton.isSelected());
      } else if (source == colorCyclingButton) {
        if (player instanceof ColorCyclePlayer) {
          ((ColorCyclePlayer) player).setColorCyclingStarted(colorCyclingButton.isSelected());
        }
      }
    }
  }
 public void actionPerformed(ActionEvent e) {
   Object source = e.getSource();
   if (source instanceof Timer) {
     doCurrentMethodStep();
     repaint();
   }
 }
 public void actionPerformed(ActionEvent evt) {
   Object obj = evt.getSource();
   if (obj instanceof JMenuItem) {
     // put the focus on the noneditable combo.
     combo1.requestFocus();
   }
 }
Example #21
0
  public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals("New Game")) {
      newGame();
    }

    if (e.getActionCommand().equals("Exit Game")) {
      exit();
    }
    if (e.getActionCommand().equals("About")) {
      JDialog f = new JDialog();
      f.add(new JLabel(new ImageIcon("splash_applet.jpg")));
      f.setSize(660, 520);
      f.setLocationRelativeTo(this);
      f.setVisible(true);
    }
  }
Example #22
0
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() instanceof JMenuItem) {
     JMenuItem item = (JMenuItem) e.getSource();
     String name = item.getText();
     Profile profile = profiles.getProfile(name);
     Component[] components = selectorPanel.getComponents();
     for (int i = 0; i < components.length; i++) {
       Component comp = components[i];
       if (comp instanceof CPCheckBox) {
         CPCheckBox scb = (CPCheckBox) comp;
         String id = scb.element.id;
         boolean enb = profile.has(id);
         scb.setState(enb);
       }
     }
   }
 }
Example #23
0
 public void actionPerformed(ActionEvent e) {
   texta.setText(
       lblName.getText()
           + text0.getText()
           + '\n'
           + lblSex.getText()
           + ((JRadioButton) e.getSource()).getText());
 }
Example #24
0
  /**
   * Handles the <tt>ActionEvent</tt> which occurred when user clicks the Search button.
   *
   * @param e the <tt>ActionEvent</tt> that notified us of the button click
   */
  public void actionPerformed(ActionEvent e) {
    JButton button = (JButton) e.getSource();
    String buttonName = button.getName();

    if (buttonName.equalsIgnoreCase("search")) {
      historyWindow.showHistoryByKeyword(searchTextField.getText());
    }
  }
 @Override
 public void actionPerformed(ActionEvent e) {
   JTextField tf = (JTextField) e.getSource();
   String test = tf.getText().trim();
   if (!test.equals("")) {
     find(test);
   }
 }
Example #26
0
 /**
  * Handle the event
  *
  * @param ae The event
  */
 public void actionPerformed(ActionEvent ae) {
   String cmd = ae.getActionCommand();
   if (cmd.equals(CMD_CONNECT)) {
     doConnect();
   } else {
     super.actionPerformed(ae);
   }
 }
Example #27
0
 public void actionPerformed(ActionEvent evt) {
   JComboBox cb = (JComboBox) evt.getSource();
   String format = (String) cb.getSelectedItem();
   if (format.equals("all formats")) {
     format = null;
   }
   fileList.setListData(findFiles(AUDIO_DIR, format));
 }
Example #28
0
  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == btnQAuswahl) {
      addQListBoxEintrag(dateiAuswählen());
    }
    if (e.getSource() == btnQEntfernen) {
      subQListBoxEintrag();
    }
    if (e.getSource() == btnZAuswahl) {
      addZListBoxEintrag(dateiAuswählen());
    }
    if (e.getSource() == btnZEntfernen) {
      subZListBoxEintrag();
    }
    if (e.getSource() == btnSync) {

      startCopy(
          (Path) quellJList.getSelectedValue().getValueMember(),
          (Path) zielJList.getSelectedValue().getValueMember());
    }
    if (e.getSource() == btnAbbruch) {
      setAbbruch();
    }
    if (e.getSource() == btnBackup) {
      MainNtray.bwvisible();
      this.invisible();
    }
  }
    public void actionPerformed(ActionEvent a) {
      String command = a.getActionCommand();
      if (command.equals("e")) {
        // Log toggle.
        if (consoleDisplayed = !consoleDisplayed) {
          splitter.add(outputScroll);
          splitter.setDividerLocation(.8);
        } else {
          splitter.remove(outputScroll);
        }
      } else if (command.equals("k")) {
        if (text.getText().contains("class")) {
          // This means we should try to compile this as normal.

          // Pulls out class name
          String code = text.getText();
          int firstPos = code.indexOf("class");
          int secondPos = code.indexOf("{");
          String name = code.substring(firstPos + "class".length() + 1, secondPos).trim();

          compileAndRun(name, text.getText());
        } else {
          // This means we should compile this as a playground.
          String code = text.getText();

          // Common import statements built-in
          String importDump = new String();
          importDump +=
              ("import java.util.*;\n"
                  + "import javax.swing.*;\n"
                  + "import javax.swing.event.*;\n"
                  + "import java.awt.*;\n"
                  + "import java.awt.event.*;\n"
                  + "import java.io.*;\n");

          // Pulls out any "import" statements and appends them to the import dump.
          int i = code.indexOf("import");
          while (i >= 0) {
            String s = code.substring(i, code.indexOf(";", i) + 1);
            code = code.replaceFirst(s, "");
            importDump += s + "\n";
            i = code.indexOf("import", i + 1);
          }

          // Inject the class header and main method
          code =
              "//User and auto-imports pre-defined\n"
                  + importDump
                  + "//Autogenerated class\npublic class Main {\npublic static void main(String[] args) {\n"
                  + code
                  + "\n}\n}";

          compileAndRun("Main", code);
        }
      }
    }
Example #30
0
    public void actionPerformed(ActionEvent e) {
      String command = e.getActionCommand();
      if (command.equals("standard")) setColorModelWRBB();
      else if (command.equals("invert")) invertCM();
      else if (command.equals("rainbow")) setColorModelRainbow();
      else if (command.equals("grey")) setColorModelGrey();
      else if (command.equals("swapBackground")) swapBackground();

      updateColors();
    }