コード例 #1
0
ファイル: ReviewDialog.java プロジェクト: rokstrnisa/RokClock
 /**
  * Create a default filename given the current date selection. If custom dates are selected, use
  * those dates; otherwise, use year and week numbers.
  *
  * @return The default filename.
  */
 private String getDefaultFilename() {
   if (yearCB.getSelectedIndex() == 0 || weekCB.getSelectedIndex() == 0)
     return "timesheet-"
         + dateFormat.format(fromDate.getDate()).replaceAll("/", "")
         + "-"
         + dateFormat.format(toDate.getDate()).replaceAll("/", "")
         + ".txt";
   return "timesheet-" + yearCB.getSelectedItem() + "wk" + weekCB.getSelectedItem() + ".txt";
 }
コード例 #2
0
  @Override
  public void actionPerformed(ActionEvent arg0) {
    // Pre-creation sanity
    if (gridPanel != null) {
      // Variable declaration
      String name, phone;
      // Make sure the fields have values
      if ((name = nameField.getText()) == "") {
        // Tell the user if not
        JOptionPane.showMessageDialog(null, "Please enter the client's name");
        return;
      }

      if ((phone = phoneField.getText()) == "") {
        JOptionPane.showMessageDialog(null, "Please enter the client's phone number");
        return;
      }

      if (hiddenRadio.isSelected()) {
        JOptionPane.showMessageDialog(null, "Please select the client's smoking preference");
        return;
      }

      // Calculate the party size
      int partySize = partyBox.getSelectedIndex() + 8;

      // Place the reservation
      bookRoom(name, phone, smokingRadio.isSelected(), partySize);
    } else {
      System.out.println("Grid panel is null");
    }
  }
コード例 #3
0
  public void itemStateChanged(ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED) {
      p5.add(mortgage);
      Slot pobject;
      pobject = Game.SlotsList[x.getProperties().get(propertydisplay.getSelectedIndex())];
      if (pobject instanceof Property) {
        ((Property) (pobject)).monopolizeProperty();
        pr1.setText("Buy Price:" + pobject.getBuyPrice());
        pr2.setText("Rent Price:" + pobject.getRentPrice());
        pr3.setText("House Price:" + pobject.getHousePrice());
        pr4.setText("Hotel Price:" + pobject.getHotelPrice());
        pr5.setText("Mortgaged:" + pobject.getMortgage());
      } else if (pobject instanceof Railroad) {
        pobject.adjustRentPrice();
        pr1.setText("Buy Price:" + pobject.getBuyPrice());
        pr2.setText("Rent Price:" + pobject.getRentPrice());
        pr3.setText("");
        pr4.setText("");
        pr5.setText("");

      } else {
        pobject.adjustDiceFactor();
        pr1.setText("Buy Price:" + pobject.getBuyPrice());
        pr2.setText("Dice Factor:" + pobject.getDiceFactor());
        pr3.setText("");
        pr4.setText("");
        pr5.setText("");
      }
    }
  }
コード例 #4
0
ファイル: PanelMore.java プロジェクト: sbrunner/josm-plugins
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Sts sts : statuses.keySet()) {
     int idx = statuses.get(sts);
     if (dlg.panelMain.mark != null && (idx == statusBox.getSelectedIndex()))
       dlg.panelMain.mark.setStatus(sts);
   }
 }
コード例 #5
0
ファイル: PanelSpec.java プロジェクト: ncrystal/josm-plugins
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Cat cat : categories.keySet()) {
     int idx = categories.get(cat);
     if (dlg.node != null && (idx == categoryBox.getSelectedIndex()))
       dlg.panelMain.mark.setCategory(cat);
   }
 }
コード例 #6
0
ファイル: PanelMore.java プロジェクト: sbrunner/josm-plugins
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Cns cns : constructions.keySet()) {
     int idx = constructions.get(cns);
     if (dlg.panelMain.mark != null && (idx == constrBox.getSelectedIndex()))
       dlg.panelMain.mark.setConstr(cns);
   }
 }
コード例 #7
0
ファイル: PanelMore.java プロジェクト: sbrunner/josm-plugins
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Con con : reflectivities.keySet()) {
     int idx = reflectivities.get(con);
     if (dlg.panelMain.mark != null && (idx == reflBox.getSelectedIndex()))
       dlg.panelMain.mark.setRefl(con);
   }
 }
コード例 #8
0
 public void actionPerformed(ActionEvent ae) {
   String cname = nameF.getText().trim();
   int state = conditions[stateC.getSelectedIndex()];
   try {
     if (isSpecialCase(cname)) {
       handleSpecialCase(cname, state);
     } else {
       JComponent comp = (JComponent) Class.forName(cname).newInstance();
       ComponentUI cui = UIManager.getUI(comp);
       cui.installUI(comp);
       results.setText("Map entries for " + cname + ":\n\n");
       if (inputB.isSelected()) {
         loadInputMap(comp.getInputMap(state), "");
         results.append("\n");
       }
       if (actionB.isSelected()) {
         loadActionMap(comp.getActionMap(), "");
         results.append("\n");
       }
       if (bindingB.isSelected()) {
         loadBindingMap(comp, state);
       }
     }
   } catch (ClassCastException cce) {
     results.setText(cname + " is not a subclass of JComponent.");
   } catch (ClassNotFoundException cnfe) {
     results.setText(cname + " was not found.");
   } catch (InstantiationException ie) {
     results.setText(cname + " could not be instantiated.");
   } catch (Exception e) {
     results.setText("Exception found:\n" + e);
     e.printStackTrace();
   }
 }
コード例 #9
0
ファイル: Controller.java プロジェクト: onyxbits/ScenePainter
  @Override
  public void valueChanged(TreeSelectionEvent e) {
    if (e.getSource() == colors && !locked) {
      TreeSelectionModel tsm = colors.getSelectionModel();
      TreePath tp[] = tsm.getSelectionPaths();
      if (tp == null) return;
      Vector<ClassedItem> tmp = new Vector<ClassedItem>();
      for (TreePath element : tp) {
        try {
          Object[] path = element.getPath();
          ClassedItem ci = new ClassedItem(path[1].toString(), path[2].toString());
          tmp.add(ci);
        } catch (Exception exp) {
          // User did not select a leafnode
        }
      }

      if (sceneElement instanceof NenyaImageSceneElement) {
        ((NenyaImageSceneElement) sceneElement).setColorList(tmp.toArray(new ClassedItem[0]));
      }
      if (sceneElement instanceof NenyaTileSceneElement) {
        ((NenyaTileSceneElement) sceneElement).setColorList(tmp.toArray(new ClassedItem[0]));
      }
      if (sceneElement instanceof NenyaComponentSceneElement) {
        ((NenyaComponentSceneElement) sceneElement)
            .getComponents()[itemList.getSelectedIndex()].setColorList(
                tmp.toArray(new ClassedItem[0]));
      }

      submitElement(sceneElement, null);
    } else {
      super.valueChanged(e);
    }
  }
コード例 #10
0
ファイル: SourcePanel.java プロジェクト: cecemel/Util
 public void actionPerformed(ActionEvent evt) {
   Object source = evt.getSource();
   if (source.equals(root)) {
     root.setSelectedIndex(directoryPane.changeRoot(root.getSelectedIndex()));
   } else if (source.equals(refresh)) {
     directoryPane.reloadTree();
   }
 }
コード例 #11
0
 private IntervalXYDataset getHistrogrammedDataAttributes(
     String[] attributes, long barsize, long timesize) {
   IntervalXYDataset dataset = null;
   if (no_intervals) {
     dataset = new XYSeriesCollection();
   } else {
     dataset = new YIntervalSeriesCollection();
   }
   for (int index = 0; index < attributes.length; index++) {
     Histogram histogram = new Histogram(barsize);
     String attribute = attributes[index];
     for (ProcessInstance pi : mylog.getInstances()) {
       Date begin;
       try {
         begin = pi.getAuditTrailEntryList().get(0).getTimestamp();
       } catch (Exception e) {
         Message.add(e.getMessage(), Message.ERROR);
         return null;
       } // starting time of process instance
       int j = 0;
       for (AuditTrailEntry ate : pi.getListOfATEs()) {
         if (ate.getAttributes().containsKey(attribute)) {
           Double val;
           val = Double.valueOf(ate.getAttributes().get(attribute));
           if (xbox.getSelectedIndex() == 2) {
             histogram.addValue(j, val);
           }
           if (xbox.getSelectedIndex() == 3) {
             histogram.addValue(timediff(begin, ate.getTimestamp()), val);
           }
           j++;
         }
       }
     }
     if (no_intervals) {
       ((XYSeriesCollection) dataset).addSeries(histogram.getXYSeries(attribute, timesize));
     } else {
       ((YIntervalSeriesCollection) dataset)
           .addSeries(histogram.getYIntervalSeries(attribute, timesize));
     }
   }
   return dataset;
 }
コード例 #12
0
 private void resetPanel() {
   cal =
       new GregorianCalendar(
           Integer.parseInt(yearSpi.getValue().toString()),
           monthBox.getSelectedIndex(),
           Integer.parseInt(lastLabel.getText()));
   startPoint_x = 20;
   startPoint_y = 10;
   panel.removeAll();
   panel.repaint();
   initCalPanel();
 }
コード例 #13
0
  public Job getEditingJob() {
    Job job = new Job();

    job.setId(id);
    job.setName(jobNameTextField.getText());
    job.setEnabled(enabledCheckBox.isSelected());
    if (scheduledRadioButton.isSelected()) {
      job.setIntervalUnit(Job.getUnits()[intervalUnitComboBox.getSelectedIndex()]);
      job.setIntervalPeriod(parseInt(intervalFormattedTextField.getText()));
    }

    return job;
  }
コード例 #14
0
ファイル: PanelSpec.java プロジェクト: ncrystal/josm-plugins
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Cat cat : moorings.keySet()) {
     int idx = moorings.get(cat);
     if (dlg.node != null && (idx == mooringBox.getSelectedIndex())) {
       dlg.panelMain.mark.setCategory(cat);
       if ((cat == Cat.INB_CALM) || (cat == Cat.INB_SBM)) {
         dlg.panelMain.mark.setObject(Obj.BOYINB);
         dlg.panelMain.mark.setShape(Shp.UNKSHP);
       } else {
         dlg.panelMain.mark.setObject(Obj.MORFAC);
         if (cat != Cat.MOR_BUOY) dlg.panelMain.mark.setShape(Shp.UNKSHP);
       }
     }
   }
   if (dlg.node != null) syncPanel();
 }
コード例 #15
0
ファイル: Ssys3.java プロジェクト: scyptnex/computing
 public void secureMove() {
   int rw = tblItems.getSelectedRow();
   if (rw == -1) {
     JOptionPane.showMessageDialog(frm, "No item selected", "Error", JOptionPane.ERROR_MESSAGE);
     return;
   }
   int idx = tblItems.convertRowIndexToModel(rw);
   String[] opts = new String[storeLocs.size()];
   for (int i = 0; i < opts.length; i++) opts[i] = storeLocs.get(i).getAbsolutePath();
   JComboBox cmbMove = new JComboBox(opts);
   cmbMove.setSelectedIndex(store.curStore(idx));
   if (JOptionPane.showConfirmDialog(frm, cmbMove, "Move item", JOptionPane.OK_CANCEL_OPTION)
       != JOptionPane.OK_OPTION) return;
   File newLoc = store.move(idx, cmbMove.getSelectedIndex());
   if (newLoc == null) System.err.println("move " + store.plainName(idx) + " unsuccessful");
   else needsSave = true;
 }
コード例 #16
0
ファイル: EmpMain.java プロジェクト: mjsung/FirstProject
 @Override
 public void actionPerformed(ActionEvent e) {
   // TODO Auto-generated method stub
   if (e.getSource() == b1) {
     int index = box.getSelectedIndex();
     String column = "";
     if (index == 0) column = "ename";
     else if (index == 1) column = "hiredate";
     else column = "deptno";
     String data = tf.getText().trim();
     if (data.length() < 1) {
       tf.requestFocus();
       return;
     }
     getFindData(column, data);
   }
   if (e.getSource() == b2) {
     getData();
   }
 }
コード例 #17
0
  /** @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == jbValider) {
      if (criterion == null) {
        criterion = new Criterion(jtfCode.getText());

        parent
            .getWorkConfiguration()
            .getCriteriaPopulation()
            .put(criterion, new ArrayList<CriterionElement>());
        parent.getWorkConfiguration().getListCriteria().add(criterion);
      }
      criterion.setSortOrder(
          (jcbSortOrder.getSelectedIndex() == 1) ? Criterion.SORT_DESC : Criterion.SORT_ASC);
      criterion.setLibelle(jtfLibelle.getText());
      criterion.setPlacement(jcbPlacementCriterion.isSelected());
      criterion.setClassement(jcbClassementCriterion.isSelected());

      setVisible(false);
    } else if (e.getSource() == jbAnnuler) {
      setVisible(false);
    }
  }
コード例 #18
0
 @Override
 protected String getEnabledValue() {
   return choices[comboBox.getSelectedIndex()].getValue();
 }
コード例 #19
0
  public void actionPerformed(ActionEvent e) {
    String event = e.getActionCommand();
    moneyLabel.setText("Money Owned:" + x.getMoney() + "");
    jcards.setText("Get out of Jail Cards Owned: " + x.getJailCards());
    if (event.equals("mortgage")
        && (Game.SlotsList[x.getProperties().get(propertydisplay.getSelectedIndex())]
            instanceof Property)) {
      Slot pobject = Game.SlotsList[x.getProperties().get(propertydisplay.getSelectedIndex())];
      if (pobject.getMortgage()) {
        if (JOptionPane.showConfirmDialog(
                null,
                "Would you like to unmortgage your property for $" + pobject.getMortgageV() * 1.10,
                "Mortgage Choice",
                JOptionPane.YES_NO_OPTION)
            == JOptionPane.YES_OPTION) {
          pobject.endMortgage();
        } else {

        }
      } else {
        if (JOptionPane.showConfirmDialog(
                null,
                "Would you like to mortgage your property for $" + pobject.getMortgageV(),
                "Mortgage Choice",
                JOptionPane.YES_NO_OPTION)
            == JOptionPane.YES_OPTION) {
          pobject.mortgageProperty();
        } else {

        }
      }
      // WIP Code!
    } else if (event.equals("buyHouse")) {
      HouseMenu one =
          new HouseMenu(
              x,
              "buy"); // pass along the player and what sort of thing the player wants to be doing
      one.setVisible(true);
      do {
        try {
          TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException a) {
          // nothing
        }
      } while (one.done == false);
      one.dispose();
    } else if (event.equals("sellHouse")) {
      HouseMenu one = new HouseMenu(x, "sell");
      one.setVisible(true);
      do {
        try {
          TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException a) {
          // nothing
        }
      } while (one.done == false);
      one.dispose();
    } else {
      Property choice =
          (Property) (Game.SlotsList[x.getProperties().get(propertydisplay.getSelectedIndex())]);
      int res =
          JOptionPane.showConfirmDialog(
              null,
              "Are you sure you want to sell this property, along with any houses and hotels?",
              "Confirm your choice",
              JOptionPane.YES_NO_OPTION);
      if (res == JOptionPane.YES_OPTION) {
        choice.sellProperty();
      } else {
        // nothing
      }
    }
  }
コード例 #20
0
ファイル: ReviewDialog.java プロジェクト: rokstrnisa/RokClock
 /**
  * Checks whether the interval has been set using the date chooser.
  *
  * @return True if custom.
  */
 boolean isIntervalCustom() {
   return yearCB.getSelectedIndex() == 0 || weekCB.getSelectedIndex() == 0;
 }
コード例 #21
0
 @Nullable
 public SearchScope getSelectedScope() {
   final JComboBox combo = getComboBox();
   int idx = combo.getSelectedIndex();
   return idx < 0 ? null : ((ScopeDescriptor) combo.getSelectedItem()).getScope();
 }
コード例 #22
0
ファイル: Animation.java プロジェクト: maeyler/Automata
 void setItem() {
   setItem(menu.getSelectedIndex());
 }
コード例 #23
0
 @Nullable
 public String getSelectedScopeName() {
   final JComboBox combo = getComboBox();
   int idx = combo.getSelectedIndex();
   return idx < 0 ? null : ((ScopeDescriptor) combo.getSelectedItem()).getDisplay();
 }