コード例 #1
0
 public void setSelected(boolean b) {
   super.setSelected(b);
   if (selected) {
     if (!(exprFieldX.hasFocus() || exprFieldY.hasFocus() || exprFieldZ.hasFocus())) {
       exprFieldX.requestFocusInWindow();
       fireCaretUpdate(exprFieldX);
     }
   }
 }
コード例 #2
0
  public void caretUpdate(CaretEvent e) {
    if (!isPopupVisible() && tf.isShowing() && tf.hasFocus()) {
      showPopup();
    }

    JTextField tf = (JTextField) e.getSource();
    String text = tf.getText().toLowerCase();

    int index = -1;
    for (int i = 0; i < super.getItemCount(); i++) {
      String item = ((String) getItemAt(i)).toLowerCase();
      if (item.startsWith(text)) {
        index = i;
        break;
      }
    }
    if (index != -1) {
      comboUi.getList().setSelectedIndex(index);
    } else {
      comboUi.getList().clearSelection();
    }

    newValue = comboUi.getList().getSelectedValue();
    System.out.println("new value set to: " + newValue);
  }
コード例 #3
0
ファイル: SearchManager2.java プロジェクト: steog88/jabref
  /**
   * Clears and focuses the search field if it is not focused. Otherwise, cycles to the next search
   * type.
   */
  public void startSearch() {
    if (increment.isSelected() && incSearch) {
      repeatIncremental();
      return;
    }
    if (!searchField.hasFocus()) {
      // searchField.setText("");
      searchField.selectAll();
      searchField.requestFocus();
    } else {
      if (increment.isSelected()) {
        floatSearch.setSelected(true);
      } else if (floatSearch.isSelected()) {
        hideSearch.setSelected(true);
      } else if (hideSearch.isSelected()) {
        showResultsInDialog.setSelected(true);
      } else if (showResultsInDialog.isSelected()) {
        searchAllBases.setSelected(true);
      } else {
        increment.setSelected(true);
      }
      increment.revalidate();
      increment.repaint();

      searchField.requestFocus();
    }
  }
コード例 #4
0
 private void validateAndUpdatePreview(JTextField src) {
   Color color;
   if (myHex.hasFocus()) {
     Color c = ColorUtil.fromHex(myHex.getText(), null);
     color = c != null ? ColorUtil.toAlpha(c, myColorWheelPanel.myColorWheel.myOpacity) : null;
   } else {
     color = gatherRGB();
   }
   if (color != null) {
     if (myColorWheelPanel.myOpacityComponent != null) {
       color = ColorUtil.toAlpha(color, myColorWheelPanel.myOpacityComponent.getValue());
     }
     updatePreview(color, src == myHex);
   }
 }
コード例 #5
0
 private boolean isFolded() {
     return !forceFocus && !input.hasFocus();
 }