Exemplo n.º 1
0
 public int getDifficulty() {
   if (easy.isSelected()) {
     return 0;
   } else if (hard.isSelected()) {
     return 1;
   } else {
     return 2;
   }
 }
Exemplo n.º 2
0
  public void setScores() {
    p1Stats.setForeground(Color.white);
    p2Stats.setForeground(Color.white);
    p1Stats.setText("Player 1| Wins: " + TTTMain.p1WinCount + "  Loss: " + TTTMain.p1LossCount);
    p2Stats.setText("Player 2| Wins: " + TTTMain.p2WinCount + "  Loss: " + TTTMain.p2LossCount);

    if (p1.isSelected()) {
      TTTMain.aiEnabled = true;
      p2Stats.setVisible(false);
    } else if (p2.isSelected()) {
      TTTMain.aiEnabled = false;
      p2Stats.setVisible(true);
    }
  }
Exemplo n.º 3
0
  @Override
  public void actionPerformed(ActionEvent ae) {
    Object source = ae.getSource();

    if (source == authorMenuItem) {
      authorFrame.setVisible(true);
    } else if (source == problemMenuItem) {
      problemFrame.setVisible(true);
    }

    if (source instanceof JRadioButtonMenuItem) {
      if (ricartAgrawala.isSelected()) vizPanel.setMethod("ricart-agrawala");
      else if (modRicartAgrawala.isSelected()) vizPanel.setMethod("modified ricart-agrawala");
      else System.out.println("ERROR: Setting method: no recognized method.");
    }
  }
  public int showProcessesType() {

    if (rdbtnmntmActiveProcesses.isSelected()) {

      return ACTIVE_PROCESS;

    } else if (rdbtnmntmAllProcesses.isSelected()) {

      return ALL_PROCESS;

    } else if (rdbtnmntmMyProcesses.isSelected()) {

      return MY_PROCESS;
    }

    return ALL_PROCESS;
  }
  /** Called when a choice was made in the animation type combo box. */
  public void animationCombo_actionPerformed() {
    int selectedIndex = animationCombo.getSelectedIndex();
    switch (selectedIndex) {
      case HackController.DISPLAY_CHANGES:
        if (!partAnimMenuItem.isSelected()) partAnimMenuItem.setSelected(true);
        break;

      case HackController.ANIMATION:
        if (!fullAnimMenuItem.isSelected()) fullAnimMenuItem.setSelected(true);
        break;

      case HackController.NO_DISPLAY_CHANGES:
        if (!noAnimMenuItem.isSelected()) noAnimMenuItem.setSelected(true);
        break;
    }

    notifyControllerListeners(ControllerEvent.ANIMATION_MODE_CHANGE, new Integer(selectedIndex));
  }
  /** Called when a choice was made in the numeric format combo box. */
  public void formatCombo_actionPerformed() {
    int selectedIndex = formatCombo.getSelectedIndex();
    switch (selectedIndex) {
      case HackController.DECIMAL_FORMAT:
        if (!decMenuItem.isSelected()) decMenuItem.setSelected(true);
        break;

      case HackController.HEXA_FORMAT:
        if (!hexaMenuItem.isSelected()) hexaMenuItem.setSelected(true);
        break;

      case HackController.BINARY_FORMAT:
        if (!binMenuItem.isSelected()) binMenuItem.setSelected(true);
        break;
    }

    notifyControllerListeners(ControllerEvent.NUMERIC_FORMAT_CHANGE, selectedIndex);
  }
Exemplo n.º 7
0
  private void toogle() {
    boolean selected = jRadioButtonMenuItem3.isSelected();

    for (Component comp : jTaskPane1.getComponents()) {
      if (comp.getClass().equals(MyAnunci.class)) {
        MyAnunci ma = (MyAnunci) comp;
        ma.setExpanded(selected);
      }
    }
  }
Exemplo n.º 8
0
 public String[] getTeamSet() {
   String[] team = new String[2];
   if (plain.isSelected()) {
     team[0] = "X WINS!";
     team[1] = "O WINS!";
   } else {
     team[0] = "SEMINOLES WIN!";
     team[1] = "GATORS WIN!";
   }
   return team;
 }
  /** Called when a choice was made in the additional display combo box. */
  public void additionalDisplayCombo_actionPerformed() {
    int selectedIndex = additionalDisplayCombo.getSelectedIndex();
    switch (selectedIndex) {
      case HackController.SCRIPT_ADDITIONAL_DISPLAY:
        if (!scriptMenuItem.isSelected()) scriptMenuItem.setSelected(true);
        break;

      case HackController.OUTPUT_ADDITIONAL_DISPLAY:
        if (!outputMenuItem.isSelected()) outputMenuItem.setSelected(true);
        break;

      case HackController.COMPARISON_ADDITIONAL_DISPLAY:
        if (!compareMenuItem.isSelected()) compareMenuItem.setSelected(true);
        break;

      case HackController.NO_ADDITIONAL_DISPLAY:
        if (!noAdditionalDisplayMenuItem.isSelected())
          noAdditionalDisplayMenuItem.setSelected(true);
        break;
    }

    notifyControllerListeners(
        ControllerEvent.ADDITIONAL_DISPLAY_CHANGE, new Integer(selectedIndex));
  }
Exemplo n.º 10
0
  public void doSelectionLaf() {
    try {
      C_Configuration cConfiguration = new C_Configuration(false);

      Enumeration lEnumeration = SC_RadioLaf.getElements();

      // fenetrePrincipale.clearOnglets();
      while (lEnumeration.hasMoreElements()) {
        JRadioButtonMenuItem lItem = (JRadioButtonMenuItem) (lEnumeration.nextElement());
        if (lItem.isSelected()) {
          cConfiguration.setLaf(lItem.getText());
          break;
        }
      }
      fenetrePrincipale.updateTexte();
      // fenetrePrincipale.doSelectionArbre();
    } catch (FichierConfInexistantException e) {
      System.err.println("-----ERREUR GRAVE N°5-----");
    }
  }
Exemplo n.º 11
0
 public void actionPerformed(ActionEvent e) {
   if (e.getActionCommand().equals("No coloring")) {
     ((TreeWindow) parent).removeColor();
   } else if (e.getActionCommand().equals("Majority coloring")) {
     ((TreeWindow) parent).tree.setMajorityColoring(majorityColoringMenuItem.isSelected());
     ((TreeWindow) parent).tree.getTree().updateBranchColorFromChildren();
     // frame.recolorBranches();
   } else if (e.getActionCommand().equals("Number of OTUs")) {
     tree.getTree().sortByNumberOfOtus();
     tree.setYOffsets(tree.getTree(), 0);
     tree.setTOffsets(tree.getTree(), 0);
     tree.setROffsets(tree.getTree(), 0);
     tree.setRadialOffsets(tree.getTree());
   } else if (e.getActionCommand().equals("Number of immediate children")) {
     tree.getTree().sortByNumberOfChildren();
     tree.setYOffsets(tree.getTree(), 0);
     tree.setTOffsets(tree.getTree(), 0);
     tree.setROffsets(tree.getTree(), 0);
     tree.setRadialOffsets(tree.getTree());
   }
 }
Exemplo n.º 12
0
 public boolean playerIsX() {
   return hx.isSelected();
 }
Exemplo n.º 13
0
 public BufferedImage getOSkin() {
   if (plain.isSelected()) {
     return plaino;
   }
   return fsuo;
 }
Exemplo n.º 14
0
 public BufferedImage getXSkin() {
   if (plain.isSelected()) {
     return plainx;
   }
   return fsux;
 }
 /* (non-Javadoc)
  * @see com.windowtester.runtime.condition.IsSelected#isSelected(com.windowtester.runtime.IUIContext)
  */
 public boolean isSelected(IUIContext ui) throws WidgetSearchException {
   JRadioButtonMenuItem item =
       (JRadioButtonMenuItem) ((IWidgetReference) ui.find(this)).getWidget();
   return item.isSelected();
 }