public void actionPerformed(ActionEvent ae) {
   String cmd = ae.getActionCommand();
   if (JOkCancelPanel.OK.equals(cmd)) {
     // update evaluator
     evaluator.name = tfName.getText();
     evaluator.type = (byte) cbType.getSelectedIndex();
     evaluator.ignoreDiagonals = cbDiagonals.isSelected();
     evaluator.investments = (byte) cbInvestment.getSelectedIndex();
     evaluator.orgFile = orgFile;
     setVisible(false);
   } else if (JOkCancelPanel.CANCEL.equals(cmd)) {
     // don't update evaluator
     setVisible(false);
   } else if (CMD_CHOOSE_FILE.equals(cmd)) {
     // get a file dialog
     JFrame f = new JFrame();
     JFileChooser jfc = Application.getFileChooser();
     int res = jfc.showOpenDialog(f);
     Application.setWorkingDirectory(jfc.getCurrentDirectory());
     if (res == JFileChooser.CANCEL_OPTION) {
       return;
     }
     orgFile = jfc.getSelectedFile();
     lOrgFileName.setText("File: " + orgFile.getName());
   }
 }
Esempio n. 2
0
 /**
  * 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";
 }
Esempio n. 3
0
 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();
   }
 }
Esempio n. 4
0
  private void savePreferences() {
    // grab the preferences so that they can be filled in from the
    // user's selections
    ThumbMakerPreferences myPreferences = ThumbMakerPreferences.getInstance();

    // x resolution text box
    myPreferences.setStringPref(ThumbMakerPreferences.RES_WIDTH_PREF_NAME, xres.getText());

    // y resolution text box
    myPreferences.setStringPref(ThumbMakerPreferences.RES_HEIGHT_PREF_NAME, yres.getText());

    // aspect ratio checkbox
    String aspectText;
    if (aspect.isSelected()) {
      aspectText = ThumbMakerPreferences.BOOLEAN_TRUE_STRING;
    } else aspectText = ThumbMakerPreferences.BOOLEAN_FALSE_STRING;
    myPreferences.setStringPref(ThumbMakerPreferences.DO_MAINTAIN_ASPECT_PREF_NAME, aspectText);

    // red slider
    myPreferences.setIntegerPref(ThumbMakerPreferences.RED_VALUE_PREF_NAME, red.getValue());

    // green slider
    myPreferences.setIntegerPref(ThumbMakerPreferences.GREEN_VALUE_PREF_NAME, green.getValue());

    // blue slider
    myPreferences.setIntegerPref(ThumbMakerPreferences.BLUE_VALUE_PREF_NAME, blue.getValue());

    // algorithm combo box
    myPreferences.setIntegerPref(
        ThumbMakerPreferences.RESIZE_ALG_PREF_NAME, algorithm.getSelectedIndex());

    // format combo box
    myPreferences.setIntegerPref(
        ThumbMakerPreferences.THUMB_FORMAT_PREF_NAME, format.getSelectedIndex());

    // prepend field
    myPreferences.setStringPref(
        ThumbMakerPreferences.STRING_TO_PREPEND_PREF_NAME, prepend.getText());

    // append field
    myPreferences.setStringPref(ThumbMakerPreferences.STRING_TO_APPEND_PREF_NAME, append.getText());

    // output folder field
    myPreferences.setStringPref(ThumbMakerPreferences.FILE_PATH_STRING_PREF_NAME, output.getText());
  }
Esempio n. 5
0
 private void addPhone() {
   if (phone.getText().length() == 10) {
     if (carriers.getSelectedIndex() == 0) {
       Main.addPhone(phone.getText() + "@txt.att.net");
     }
     if (carriers.getSelectedIndex() == 1) {
       Main.addPhone(phone.getText() + "@myboostmobile.com");
     }
     if (carriers.getSelectedIndex() == 2) {
       Main.addPhone(phone.getText() + "@mobile.celloneusa.com");
     }
     if (carriers.getSelectedIndex() == 3) {
       Main.addPhone(phone.getText() + "@messaging.nextel.com");
     }
     if (carriers.getSelectedIndex() == 4) {
       Main.addPhone(phone.getText() + "@tmomail.net");
     }
     if (carriers.getSelectedIndex() == 5) {
       Main.addPhone(phone.getText() + "@txt.att.net");
     }
     if (carriers.getSelectedIndex() == 6) {
       Main.addPhone(phone.getText() + "@email.uscc.net");
     }
     if (carriers.getSelectedIndex() == 7) {
       Main.addPhone(phone.getText() + "@messaging.sprintpcs.com");
     }
     if (carriers.getSelectedIndex() == 8) {
       Main.addPhone(phone.getText() + "@vtext.com");
     }
     if (carriers.getSelectedIndex() == 9) {
       Main.addPhone(phone.getText() + "@vmobl.com");
     }
     displayInformation();
     phone.setText("");
     carriers.setSelectedIndex(0);
   } else {
     results.setText("Please add 10 digit cell number.");
   }
 }
Esempio n. 6
0
 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;
 }
Esempio n. 7
0
 /**
  * Checks whether the interval has been set using the date chooser.
  *
  * @return True if custom.
  */
 boolean isIntervalCustom() {
   return yearCB.getSelectedIndex() == 0 || weekCB.getSelectedIndex() == 0;
 }
Esempio n. 8
0
  private void savePhone() {

    if (phone.getText().length() == 10) {
      File f = new File("config.txt");
      Scanner sc;

      ArrayList<String> config = new ArrayList<String>();

      try {
        sc = new Scanner(f);

        while (sc.hasNext()) {
          String s = sc.nextLine();
          config.add(s);
        }
        sc.close();

      } catch (FileNotFoundException e2) {
        results.setText("Error reading config.txt");
      }

      int i = 0;

      for (String s : config) {

        if (s.equals("PhoneNumbers:")) {
          break;
        }
        i++;
      }

      if (carriers.getSelectedIndex() == 0) {
        config.add(i + 1, phone.getText() + "@txt.att.net");
      }
      if (carriers.getSelectedIndex() == 1) {
        config.add(i + 1, phone.getText() + "@myboostmobile.com");
      }
      if (carriers.getSelectedIndex() == 2) {
        config.add(i + 1, phone.getText() + "@mobile.celloneusa.com");
      }
      if (carriers.getSelectedIndex() == 3) {
        config.add(i + 1, phone.getText() + "@messaging.nextel.com");
      }
      if (carriers.getSelectedIndex() == 4) {
        config.add(i + 1, phone.getText() + "@tmomail.net");
      }
      if (carriers.getSelectedIndex() == 5) {
        config.add(i + 1, phone.getText() + "@txt.att.net");
      }
      if (carriers.getSelectedIndex() == 6) {
        config.add(i + 1, phone.getText() + "@email.uscc.net");
      }
      if (carriers.getSelectedIndex() == 7) {
        config.add(i + 1, phone.getText() + "@messaging.sprintpcs.com");
      }
      if (carriers.getSelectedIndex() == 8) {
        config.add(i + 1, phone.getText() + "@vtext.com");
      }
      if (carriers.getSelectedIndex() == 9) {
        config.add(i + 1, phone.getText() + "@vmobl.com");
      }

      PrintWriter writer = null;
      try {
        writer = new PrintWriter("config.txt", "UTF-8");
        for (String s : config) {
          writer.println(s);
        }

      } catch (FileNotFoundException e1) {
        e1.printStackTrace();
      } catch (UnsupportedEncodingException e1) {
        e1.printStackTrace();
      }
      writer.close();
      addPhone();
    } else {
      results.setText("Please add 10 digit cell number.");
    }
  }
 public void itemStateChanged(ItemEvent evt) {
   // only on 'selection' event
   if (evt.getStateChange() == ItemEvent.SELECTED) {
     clOptions.show(pOptions, types[cbType.getSelectedIndex()]);
   }
 }
 @Override
 protected String getEnabledValue() {
   return choices[comboBox.getSelectedIndex()].getValue();
 }
Esempio n. 11
0
 void setItem() {
   setItem(menu.getSelectedIndex());
 }