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

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

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

JComboBox.getComponents介绍

暂无

代码示例

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

JComboBox coloredArrowsCombo = myComboBox;
   BufferedImage coloredArrowsImage = null;
   try {
     coloredArrowsImage = ImageIO.read(AppVariables.class.getResource("resources/passed.png"));
   } catch (IOException ex) {
     Logger.getLogger(someClessName.class.getName()).log(Level.SEVERE, null, ex);
   }
   if (!(coloredArrowsImage == null)) {
     Icon coloredArrowsIcon = new ImageIcon(coloredArrowsImage);
     Component[] comp = coloredArrowsCombo.getComponents();
     for (int i = 0; i < comp.length; i++) {
       if (comp[i] instanceof MetalComboBoxButton) {
         MetalComboBoxButton coloredArrowsButton = (MetalComboBoxButton) comp[i];
         coloredArrowsButton.setComboIcon(coloredArrowsIcon);
         break;
       }
     }
   }

代码示例来源:origin: com.jidesoft/jide-oss

private void initHidePopupProperty() {
  JComboBox comboBox = new JComboBox();
  comboBox.setEnabled(isEnabled());
  comboBox.setEditable(true);
  comboBox.doLayout();
  Component[] components = comboBox.getComponents();
  for (Component component : components) {
    if (component instanceof AbstractButton) {
      HIDE_POPUP_KEY = ((AbstractButton) component).getClientProperty("doNotCancelPopup");
      break;
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

private void updateToolTipTextForChildren()
{
  Component[] children= comboBox.getComponents();
  for (int i= 0; i < children.length; ++i)
  {
    if (children[i] instanceof JComponent)
    {
      ((JComponent) children[i]).setToolTipText(
        comboBox.getToolTipText());
    }
  }
}

代码示例来源:origin: ontop/ontop

private void setErrorBackground(JComboBox comboBox) {
  JTextField text = ((JTextField) comboBox.getEditor().getEditorComponent());
  text.setBackground(ERROR_TEXTFIELD_BACKGROUND);
  Component[] comp = comboBox.getComponents();
  for (int i = 0; i < comp.length; i++) {// hack valid only for Metal L&F
    if (comp[i] instanceof MetalComboBoxButton) {
      MetalComboBoxButton coloredArrowsButton = (MetalComboBoxButton) comp[i];
      coloredArrowsButton.setBackground(null);
      break;
    }
  }
  comboBox.requestFocus();
}

代码示例来源:origin: ontop/ontop

private void setErrorBackground(JComboBox comboBox) {
  JTextField text = ((JTextField) comboBox.getEditor().getEditorComponent());
  text.setBackground(ERROR_TEXTFIELD_BACKGROUND);
  Component[] comp = comboBox.getComponents();
  for (int i = 0; i < comp.length; i++) {// hack valid only for Metal L&F
    if (comp[i] instanceof MetalComboBoxButton) {
      MetalComboBoxButton coloredArrowsButton = (MetalComboBoxButton) comp[i];
      coloredArrowsButton.setBackground(null);
      break;
    }
  }
  comboBox.requestFocus();
}

相关文章

JComboBox类方法