Exemple #1
0
  /**
   * return the String id of the chosen server name
   *
   * @return the server name
   */
  public String getServer() {
    Object selected = serverSelector.getSelectedItem();
    if (selected == null) {
      return null;
    }
    AddeServer server;
    if (selected instanceof AddeServer) {
      server = (AddeServer) selected;
      return server.getName();
    }
    String serverName = selected.toString();
    server = getIdv().getIdvChooserManager().addAddeServer(serverName);
    addeServers = getIdv().getIdvChooserManager().getAddeServers(getGroupType());

    Object selectedGroup = groupSelector.getSelectedItem();
    AddeServer.Group group = null;
    if (selectedGroup != null) {
      group =
          getIdv()
              .getIdvChooserManager()
              .addAddeServerGroup(server, selectedGroup.toString(), getGroupType());
    }

    boolean old = ignoreStateChangedEvents;
    ignoreStateChangedEvents = true;
    GuiUtils.setListData(serverSelector, addeServers);
    serverSelector.setSelectedItem(server);
    setGroups();
    if (group != null) {
      groupSelector.setSelectedItem(group);
    }
    ignoreStateChangedEvents = old;
    return server.getName();
  }
Exemple #2
0
 public String[] getPuolustaja() {
   String[] pelaajat = new String[3];
   pelaajat[0] = (String) puolustaja1.getSelectedItem();
   pelaajat[1] = (String) puolustaja2.getSelectedItem();
   pelaajat[2] = (String) puolustaja3.getSelectedItem();
   return pelaajat;
 }
 public void actionPerformed(ActionEvent e) {
   if (cyear.getSelectedItem() != null) {
     String b = cyear.getSelectedItem().toString();
     currentYear = Integer.parseInt(b);
     refreshCalendar(currentMonth, currentYear);
   }
 }
  /*
   * Gets the user choice for font, style and size and redraws the text
   *     accordingly.
   */
  public void setSampleFont() {
    // Get the font name from the JComboBox
    fontName = (String) facenameCombo.getSelectedItem();

    sampleField.setText(textField.getText());

    // Get the font style from the JCheckBoxes
    fontStyle = 0;
    if (italicCheckBox.isSelected()) fontStyle += Font.ITALIC;
    if (boldCheckBox.isSelected()) fontStyle += Font.BOLD;

    // Get the font size
    fontSize = 0;

    fontSize = Integer.parseInt((String) sizeCombo.getSelectedItem());

    // THE FOLLOWING IS NO LONGER NEEDED
    //            if(smallButton.isSelected())
    //                  fontSize=SMALL;
    //            else if(mediumButton.isSelected())
    //                  fontSize=MEDIUM;
    //            else if(largeButton.isSelected())
    //                  fontSize=LARGE;

    // Set the font of the text field
    sampleField.setFont(new Font(fontName, fontStyle, fontSize));
    sampleField.setForeground(fontColor);
    sampleField.repaint();

    pack();
  } // end setSampleFont method
Exemple #5
0
    @Override
    public void actionPerformed(ActionEvent e) {
      // TODO Auto-generated method stub

      Object source = e.getSource();
      if (source == ok) {
        response = APPLY_OPTION;
        this.setVisible(false);
      } else if (source == cancel) {
        response = CANCEL_OPTION;
        this.setVisible(false);
      } else if (source == sizeCombo) {
        // get the number from the source
        JComboBox number = (JComboBox) source;
        String numberItem = (String) number.getSelectedItem();
        Font temp = example.getFont();
        // then set the font
        int newSize = Integer.parseInt(numberItem);
        example.setFont(new Font(temp.getFamily(), temp.getStyle(), newSize));
      } else if (source == fontCombo) {
        JComboBox font = (JComboBox) source;
        String s = (String) font.getSelectedItem();
        Font tmp = example.getFont();
        example.setFont(new Font(s, tmp.getStyle(), tmp.getSize()));
      } else if (source == foreground) {
        Color tmp = JColorChooser.showDialog(this, "Choose text color", example.getForeground());
        MenuBar.shapeLBG.setBackground(tmp);
        if (tmp != null) example.setForeground(tmp);
      }
    }
Exemple #6
0
 public String[] getKeskikentta() {
   String[] pelaajat = new String[4];
   pelaajat[0] = (String) keskikentta1.getSelectedItem();
   pelaajat[1] = (String) keskikentta2.getSelectedItem();
   pelaajat[2] = (String) keskikentta3.getSelectedItem();
   pelaajat[3] = (String) keskikentta4.getSelectedItem();
   return pelaajat;
 }
 /**
  * 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";
 }
  protected void GetFields() {
    if (_PreviousPersonnel == null) return;

    _PreviousPersonnel.setName(_NameTextField.getText());
    _PreviousPersonnel.setCallsign(_CallsignTextField.getText());
    _PreviousPersonnel.setRank((Rank) _RankCombo.getSelectedItem());
    _PreviousPersonnel.setRating((Rating) _RatingCombo.getSelectedItem());
    _PreviousPersonnel.setNotes(_NotesTextArea.getText());
  }
  private void onOK() {

    if (nameTextField.getText().length() < 3
        || nameTextField.getText().length() > 24
        || !nameTextField.getText().matches("[a-z0-9]+")) {
      JOptionPane.showMessageDialog(
          this,
          "Invalid storage account name. The name should be between 3 and 24 characters long and \n"
              + "can contain only lowercase letters and numbers.",
          "Error creating the storage account",
          JOptionPane.ERROR_MESSAGE);
      return;
    }

    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    createProgressBar.setVisible(true);

    try {
      String name = nameTextField.getText();
      String region =
          (regionOrAffinityGroupComboBox.getSelectedItem() instanceof Location)
              ? regionOrAffinityGroupComboBox.getSelectedItem().toString()
              : "";
      String affinityGroup =
          (regionOrAffinityGroupComboBox.getSelectedItem() instanceof AffinityGroup)
              ? regionOrAffinityGroupComboBox.getSelectedItem().toString()
              : "";
      String replication = replicationComboBox.getSelectedItem().toString();

      storageAccount =
          new StorageAccount(
              name, replication, region, affinityGroup, "", subscription.getId().toString());
      AzureSDKManagerImpl.getManager().createStorageAccount(storageAccount);
      AzureSDKManagerImpl.getManager().refreshStorageAccountInformation(storageAccount);

      onCreate.run();
    } catch (AzureCmdException e) {
      storageAccount = null;
      UIHelper.showException(
          "An error occurred while trying to create the specified storage account.",
          e,
          "Error Creating Storage Account",
          false,
          true);
    }

    setCursor(Cursor.getDefaultCursor());

    this.setVisible(false);
    dispose();
  }
Exemple #10
0
 /**
  * Get the selected AddeServer
  *
  * @return the server or null
  */
 private AddeServer getAddeServer() {
   Object selected = serverSelector.getSelectedItem();
   if ((selected != null) && (selected instanceof AddeServer)) {
     return (AddeServer) selected;
   }
   return null;
 }
 private void dataTypeComboAction(ActionEvent e) {
   String comboDataType = (String) dataTypeCombo.getSelectedItem();
   String dataType = objEntityViewField.getDataType();
   if (dataType != comboDataType) {
     objEntityViewField.setDataType(comboDataType);
   }
 }
Exemple #12
0
 private void gcChanged() {
   GCWrapper wrap = (GCWrapper) gcSelection.getSelectedItem();
   // assert wrap != null;
   GraphicsConfiguration gc = wrap.getGC();
   // assert gc != null;
   // Image Caps
   ImageCapabilities imageCaps = gc.getImageCapabilities();
   imageAccelerated.setSelected(imageCaps.isAccelerated());
   imageTrueVolatile.setSelected(imageCaps.isTrueVolatile());
   // Buffer Caps
   BufferCapabilities bufferCaps = gc.getBufferCapabilities();
   flipping.setSelected(bufferCaps.isPageFlipping());
   flippingMethod.setText(getFlipText(bufferCaps.getFlipContents()));
   fullScreen.setSelected(bufferCaps.isFullScreenRequired());
   multiBuffer.setSelected(bufferCaps.isMultiBufferAvailable());
   // Front buffer caps
   imageCaps = bufferCaps.getFrontBufferCapabilities();
   fbAccelerated.setSelected(imageCaps.isAccelerated());
   fbTrueVolatile.setSelected(imageCaps.isTrueVolatile());
   imageCaps = bufferCaps.getFrontBufferCapabilities();
   // Back buffer caps
   imageCaps = bufferCaps.getBackBufferCapabilities();
   bbAccelerated.setSelected(imageCaps.isAccelerated());
   bbTrueVolatile.setSelected(imageCaps.isTrueVolatile());
 }
  private void copyFile() throws Exception {
    // Load the JDBC driver
    Class.forName(((String) jcboDriver.getSelectedItem()).trim());
    System.out.println("Driver loaded");

    // Establish a connection
    Connection conn =
        DriverManager.getConnection(
            ((String) jcboURL.getSelectedItem()).trim(),
            jtfUsername.getText().trim(),
            String.valueOf(jtfPassword.getPassword()).trim());
    System.out.println("Database connected");

    // Read each line from the text file and insert it to the table
    insertRows(conn);
  }
 @Override
 public void onExit() {
   // save all painters
   for (EntryListPanel panel : listPanelSet) {
     myjava.gui.syntax.Painter painter = panel.getPainter();
     if (!painter.equals(myjava.gui.syntax.Painter.getDefaultInstance())) {
       myjava.gui.syntax.Painter.add(painter);
       setConfig("painter.userDefined." + painter.getName(), painter.toWritableString());
     }
     if (painter.equals(painterComboBox.getSelectedItem())) {
       // selected painter
       setConfig("syntax.selectedPainter", painter.getName());
       myjava.gui.syntax.Painter.setCurrentInstance(painter);
     }
   }
   // remove "removed painters"
   for (myjava.gui.syntax.Painter removed : removedPainters) {
     removeConfig0("painter.userDefined." + removed.getName());
     myjava.gui.syntax.Painter.remove(removed);
   }
   // highlight?
   boolean _highlightSyntax = highlightSyntax.isSelected();
   boolean _matchBracket = matchBracket.isSelected();
   MyUmbrellaLayerUI.setHighlightingStatus(_highlightSyntax, _matchBracket);
   setConfig("syntax.highlight", _highlightSyntax + "");
   setConfig("syntax.matchBrackets", _matchBracket + "");
 }
  private void handleEntryAction(ActionEvent actionEvent)
      throws IOException, ParserConfigurationException, XPathExpressionException, SAXException,
          NoItemException {
    if (this.getGazetteer() == null) {
      Util.getLogger().severe("No gazeteer is registered");
      return;
    }

    String lookupString;

    JComboBox cmb = ((JComboBox) actionEvent.getSource());
    lookupString = cmb.getSelectedItem().toString();

    if (lookupString == null || lookupString.length() < 1) return;

    java.util.List<PointOfInterest> results = this.gazetteer.findPlaces(lookupString);
    if (results == null || results.size() == 0) return;

    this.controller.moveToLocation(results.get(0));

    // Add it to the list if not already there
    for (int i = 0; i < cmb.getItemCount(); i++) {
      Object oi = cmb.getItemAt(i);
      if (oi != null && oi.toString().trim().equals(lookupString)) return; // item exists
    }
    cmb.insertItemAt(lookupString, 0);
  }
Exemple #16
0
  /**
   * Get the image group from the gui.
   *
   * @return The iamge group.
   */
  protected String getGroup() {
    Object selected = groupSelector.getSelectedItem();
    if (selected == null) {
      return null;
    }
    if (selected instanceof AddeServer.Group) {
      AddeServer.Group group = (AddeServer.Group) selected;
      return group.getName();
    }

    String groupName = selected.toString().trim();
    if ((groupName.length() > 0)) {
      // Force the get in case they typed a server name
      getServer();
      AddeServer server = getAddeServer();
      if (server != null) {
        AddeServer.Group group =
            getIdv().getIdvChooserManager().addAddeServerGroup(server, groupName, getGroupType());
        if (!group.getActive()) {
          getIdv().getIdvChooserManager().activateAddeServerGroup(server, group);
        }
        // Now put the list of groups back in to the selector
        setGroups();
        groupSelector.setSelectedItem(group);
      }
    }

    return groupName;
  }
Exemple #17
0
  /**
   * Get the Lincese text from a text file specified in the PropertyBox.
   *
   * @return String - License text.
   */
  public String getLicenseText() {
    StringBuffer textBuffer = new StringBuffer();
    try {
      String fileName = RuntimeProperties.GPL_EN_LICENSE_FILE_NAME;
      if (cbLang != null
          && cbLang.getSelectedItem() != null
          && cbLang.getSelectedItem().toString().equalsIgnoreCase("Eesti")) {
        fileName = RuntimeProperties.GPL_EE_LICENSE_FILE_NAME;
      }

      InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName);

      if (is == null) return "";

      BufferedReader in = new BufferedReader(new InputStreamReader(is));
      String str;
      while ((str = in.readLine()) != null) {
        textBuffer.append(str);
        textBuffer.append("\n");
      }
      in.close();
    } catch (IOException e) {
      logger.error(null, e);
    }
    return textBuffer.toString();
  } // getLicenseText
 public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
   // return immediately when selecting an item
   if (selecting) {
     return;
   }
   // insert the string into the document
   super.insertString(offs, str, a);
   // lookup and select a matching item
   Object item = lookupItem(getText(0, getLength()));
   if (item != null) {
     setSelectedItem(item);
   } else {
     // keep old item selected if there is no match
     item = comboBox.getSelectedItem();
     // imitate no insert (later on offs will be incremented by str.length(): selection won't move
     // forward)
     offs = offs - str.length();
     // provide feedback to the user that his input has been received but can not be accepted
     comboBox
         .getToolkit()
         .beep(); // when available use: UIManager.getLookAndFeel().provideErrorFeedback(comboBox);
   }
   setText(item.toString());
   // select the completed part
   highlightCompletedText(offs + str.length());
 }
Exemple #19
0
  /**
   * Create preview component.
   *
   * @param type type
   * @param comboBox the options.
   * @param prefSize the preferred size
   * @return the component.
   */
  private static Component createPreview(int type, final JComboBox comboBox, Dimension prefSize) {
    JComponent preview = null;

    if (type == DeviceConfigurationComboBoxModel.AUDIO) {
      Object selectedItem = comboBox.getSelectedItem();

      if (selectedItem instanceof AudioSystem) {
        AudioSystem audioSystem = (AudioSystem) selectedItem;

        if (!NoneAudioSystem.LOCATOR_PROTOCOL.equalsIgnoreCase(audioSystem.getLocatorProtocol())) {
          preview = new TransparentPanel(new GridBagLayout());
          createAudioSystemControls(audioSystem, preview);
        }
      }
    } else if (type == DeviceConfigurationComboBoxModel.VIDEO) {
      JLabel noPreview =
          new JLabel(
              NeomediaActivator.getResources().getI18NString("impl.media.configform.NO_PREVIEW"));

      noPreview.setHorizontalAlignment(SwingConstants.CENTER);
      noPreview.setVerticalAlignment(SwingConstants.CENTER);

      preview = createVideoContainer(noPreview);
      preview.setPreferredSize(prefSize);

      Object selectedItem = comboBox.getSelectedItem();
      CaptureDeviceInfo device = null;
      if (selectedItem instanceof DeviceConfigurationComboBoxModel.CaptureDevice)
        device = ((DeviceConfigurationComboBoxModel.CaptureDevice) selectedItem).info;

      Exception exception;
      try {
        createVideoPreview(device, preview);
        exception = null;
      } catch (IOException ex) {
        exception = ex;
      } catch (MediaException ex) {
        exception = ex;
      }
      if (exception != null) {
        logger.error("Failed to create preview for device " + device, exception);
        device = null;
      }
    }

    return preview;
  }
  private void objAttributeComboAction(ActionEvent e) {

    ObjAttribute selectedObjAttribute = (ObjAttribute) objAttributeCombo.getSelectedItem();
    ObjAttribute fieldObjAttribute = objEntityViewField.getObjAttribute();
    if (selectedObjAttribute != fieldObjAttribute) {
      objEntityViewField.setObjAttribute(selectedObjAttribute);
    }
  }
  public void actionPerformed(ActionEvent e) {

    parent
        .getParent()
        .getGrid()
        .setHeatMap(species.getSelectedItem().toString()); // I now regret the parent model
    parent.getParent().refresh();
  }
Exemple #22
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));
 }
Exemple #23
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);
      }
    }
Exemple #24
0
  private void onOK() {
    System.out.println("pase por aqui");
    int tamanyHidato = (int) spinnerTamanyHidato.getValue();
    int forats = (int) spinnerForats.getValue();
    int numerosPrecolocats = (int) spinnerNumerosPrecolocats.getValue();
    String dificultat = (String) comboBoxDificultat.getSelectedItem();

    ControladorHidato.fesCreacioAutomatica(tamanyHidato, forats, numerosPrecolocats, dificultat);
    dispose();
  }
Exemple #25
0
 @Override
 public void actionPerformed(ActionEvent ae) {
   if (ae.getSource() == partsPileUpSubmitButton) {
     app.sendObjectToServer(
         new Message("partsPiledUp_" + (String) partsPileUpComboBox.getSelectedItem()));
   }
   if (ae.getSource() == noPartsSubmitButton) {
     app.sendObjectToServer(
         new Message("noGoodParts_" + (String) noGoodPartsComboBox.getSelectedItem()));
   }
   if (ae.getSource() == partsUnstableSubmitButton) {
     app.sendObjectToServer(
         new Message("unstableParts_" + (String) partsUnstableComboBox.getSelectedItem()));
   }
   if (ae.getSource() == partsRobotSubmitButton) {
     app.sendObjectToServer(
         new Message("partsRobotInWay_" + (String) partsRobotComboBox.getSelectedItem()));
   }
 }
Exemple #26
0
  /**
   * Saves the user input when the "Next" wizard buttons is clicked.
   *
   * @param registration the SIPAccountRegistration
   * @return
   */
  public boolean commitPanel(SecurityAccountRegistration registration) {
    registration.setDefaultEncryption(enableDefaultEncryption.isSelected());
    registration.setEncryptionProtocols(encryptionConfigurationTableModel.getEncryptionProtocols());
    registration.setEncryptionProtocolStatus(
        encryptionConfigurationTableModel.getEncryptionProtocolStatus());
    registration.setSipZrtpAttribute(enableSipZrtpAttribute.isSelected());
    registration.setSavpOption(((SavpOption) cboSavpOption.getSelectedItem()).option);
    registration.setSDesCipherSuites(cipherModel.getEnabledCiphers());

    return true;
  }
 private StockpileItem getExistingItem() {
   Item typeItem = (Item) jItems.getSelectedItem();
   boolean copy = jCopy.isSelected();
   if (getStockpile() != null && typeItem != null) {
     for (StockpileItem item : getStockpile().getItems()) {
       if (item.getTypeID() == typeItem.getTypeID() && (copy == item.isBPC())) {
         return item;
       }
     }
   }
   return null;
 }
Exemple #28
0
 public void getFindData() {
   for (int i = model.getRowCount() - 1; i >= 0; i--) {
     model.removeRow(i);
   }
   String pub = box.getSelectedItem().toString();
   ArrayList<Book> list = bm.bookFindData(pub);
   tf.setText(pub);
   for (Book book : list) {
     String[] data = {String.valueOf(book.getNo()), book.getTitle(), book.getAuthor()};
     model.addRow(data);
   }
 }
Exemple #29
0
  /**
   * Изменить масштаб
   *
   * @param unit Шаг изменения
   */
  public void setZoomItem(int unit) {
    //        int index = cmbScale.getSelectedIndex();
    //        index += unit;
    //        if ( index > -1 && index < cmbScale.getItemCount() )
    //        {
    //            cmbScale.setSelectedIndex( index );
    //        }

    String txtScale = cmbScale.getSelectedItem().toString();
    int newScale = parseScale(txtScale);
    newScale = newScale + (100 * unit);
    cmbScale.setSelectedItem("1:" + newScale);
  }
  public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();

    if (source == bRes) {
      tname.setText("");
      textra.setText("");
    } else {
      if (it.isSelected()) field = 1;
      else if (civil.isSelected()) field = 2;
      else if (mech.isSelected()) field = 3;

      if (tname.getText().equals("") | textra.getText().equals("") | field == 0)
        JOptionPane.showMessageDialog(null, "Please Fill in All Entries!!");
      else {
        String sal = (String) cbsal.getSelectedItem();

        try {
          // Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          // Connection conn=DriverManager.getConnection("jdbc:odbc:go");
          Class.forName("com.mysql.jdbc.Driver").newInstance();
          Connection conn = DriverManager.getConnection("jdbc:mysql:///go", "root", "");
          Statement pst = conn.createStatement();

          pst.executeUpdate(
              "Insert into company values('"
                  + tname.getText()
                  + "','"
                  + textra.getText()
                  + "','"
                  + (String) sal
                  + "','"
                  + field
                  + "','"
                  + tusr.getText()
                  + "','"
                  + tpwd.getText()
                  + "')");
          conn.close();
          String msg =
              "Your Details are Stored. Login again to View Related applicants!  Thank You!!";
          JOptionPane.showMessageDialog(null, msg);
          setVisible(false);
          login ab = new login();

        } catch (Exception exc) {
          JOptionPane.showMessageDialog(null, tname.getText() + " : " + exc);
          System.exit(0);
        }
      }
    }
  }