javax.swing.JComboBox.transferFocus()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(201)

本文整理了Java中javax.swing.JComboBox.transferFocus()方法的一些代码示例,展示了JComboBox.transferFocus()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComboBox.transferFocus()方法的具体详情如下:
包路径:javax.swing.JComboBox
类名称:JComboBox
方法名:transferFocus

JComboBox.transferFocus介绍

暂无

代码示例

代码示例来源:origin: org.tentackle/tentackle-swing

@Override
public void transferFocus() {
 transferFocusDone = true;
 super.transferFocus();
}

代码示例来源:origin: stackoverflow.com

private void setComboBoxFocus(JComboBox box) {
  box.addItemListener(
     new ItemListener(){
       public void itemStateChanged(ItemEvent e){
         if(e.getStateChange() == ItemEvent.SELECTED)
         {
           String titleSelected = box.getSelectedItem().toString();
           System.out.println(titleSelected);
           box.transferFocus();
         }
       }
     });
}

代码示例来源:origin: jfree/jfreechart

@Override
  public void actionPerformed(ActionEvent evt) {
    getSelector().transferFocus();
  }
});

代码示例来源:origin: org.jfree/com.springsource.org.jfree

public void actionPerformed(final ActionEvent evt) {
    getSelector().transferFocus();
  }
});

代码示例来源:origin: org.jfree/jcommon

public void actionPerformed(final ActionEvent evt) {
    getSelector().transferFocus();
  }
});

代码示例来源:origin: jfree/jcommon

public void actionPerformed(final ActionEvent evt) {
    getSelector().transferFocus();
  }
});

代码示例来源:origin: baishui2004/common_gui_tools

public void actionPerformed(ActionEvent event) {
    curAction = ((JComboBox) event.getSource()).getSelectedItem().toString();
    if (!curAction.equals(action_onlySearch)) {
      // 将焦点转移到下一个组件,就好像此 Component 曾是焦点所有者
      ((JComboBox) event.getSource()).transferFocus();
      showMessage("非查找操作务必确认不会对原文件(夹)造成意外损害!", "警告", JOptionPane.WARNING_MESSAGE);
    }
    if (curAction.equals(action_copyFile) || curAction.equals(action_cutFile)) {
      actionTextField.setEnabled(true);
      action_chooseButton.setEnabled(true);
    } else {
      actionTextField.setText("");
      actionTextField.setEnabled(false);
      action_chooseButton.setEnabled(false);
    }
  }
});

代码示例来源:origin: stackoverflow.com

final JComboBox simpleBox = new JComboBox(Locale.getAvailableLocales());
 // this line configures the combo to only commit on ENTER 
 // or selecting an item from the list
 simpleBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
 //
 // simpleBox.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
 //     Collections.EMPTY_SET);
 // just noticed the OPs edit - following indeed is easier to disable _all_ traversal
 // keys with one statement
 simpleBox.setFocusTraversalKeysEnabled(false);
 Action myAction = new AbstractAction() {
   @Override
   public void actionPerformed(ActionEvent e) {
     LOG.info("got it!");
     simpleBox.transferFocus();
   }
 };
 simpleBox.getActionMap().put("tab-action", myAction);
 simpleBox.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
   .put(KeyStroke.getKeyStroke("TAB"), "tab-action");

代码示例来源:origin: org.zaproxy/zap

/**
 * Make sure the user acknowledges the Users corresponding to this context will be deleted.
 * 
 * @return true, if successful
 */
private boolean confirmAndExecuteUsersDeletion() {
  ExtensionUserManagement usersExtension = Control.getSingleton().getExtensionLoader().getExtension(ExtensionUserManagement.class);
  if (usersExtension != null) {
    if (usersExtension.getSharedContextUsers(getUISharedContext()).size() > 0) {
      authenticationMethodsComboBox.transferFocus();
      int choice = JOptionPane.showConfirmDialog(this,
          Constant.messages.getString("authentication.dialog.confirmChange.label"),
          Constant.messages.getString("authentication.dialog.confirmChange.title"),
          JOptionPane.OK_CANCEL_OPTION);
      if (choice == JOptionPane.CANCEL_OPTION) {
        return false;
      }
      // Removing the users from the 'shared context' (the UI) will cause their removal at
      // save as well
      usersExtension.removeSharedContextUsers(getUISharedContext());
    }
  }
  return true;
}

相关文章

JComboBox类方法