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

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

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

JComboBox.getUI介绍

暂无

代码示例

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

public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
  JComboBox box = (JComboBox) e.getSource();
  Object comp = box.getUI().getAccessibleChild(box, 0);
  if (!(comp instanceof JPopupMenu)) return;
  JComponent scrollPane = (JComponent) ((JPopupMenu) comp).getComponent(0);
  Dimension size = new Dimension();
  size.width = box.getPreferredSize().width;
  size.height = scrollPane.getPreferredSize().height;
  scrollPane.setPreferredSize(size);
  //  following line for Tiger
  // scrollPane.setMaximumSize(size);
}

代码示例来源:origin: com.github.insubstantial/substance

@Override
  public TransitionAwareUI getTransitionAwareUI() {
    return (TransitionAwareUI) comboBox.getUI();
  }
}, SubstanceCoreUtilities

代码示例来源:origin: org.java.net.substance/substance

@Override
  public TransitionAwareUI getTransitionAwareUI() {
    return (TransitionAwareUI) comboBox.getUI();
  }
}, SubstanceCoreUtilities

代码示例来源:origin: JetBrains/jediterm

@Nullable
public static ComboPopup getComboBoxPopup(@NotNull JComboBox comboBox) {
  final ComboBoxUI ui = comboBox.getUI();
  if (ui instanceof BasicComboBoxUI) {
    return ReflectionUtil.getField(BasicComboBoxUI.class, ui, ComboPopup.class, "popup");
  }
  return null;
}

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

public void run() {
    cb.setSelectedIndex(index);
    if (cb.getUI().isPopupVisible(cb))
      cb.getUI().setPopupVisible(cb, false);
  }
});

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

public void run() {
    cb.getUI().setPopupVisible(cb, true);
  }
});

代码示例来源:origin: org.swinglabs.swingx/swingx-all

protected static JList getPopupListFor(JComboBox comboBox) {
  int count = comboBox.getUI().getAccessibleChildrenCount(comboBox);
  for (int i = 0; i < count; i++) {
    Accessible a = comboBox.getUI().getAccessibleChild(comboBox, i);
    
    if (a instanceof ComboPopup) {
      return ((ComboPopup) a).getList();
    }
  }
  return null;
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

protected static JList getPopupListFor(JComboBox comboBox) {
  int count = comboBox.getUI().getAccessibleChildrenCount(comboBox);
  for (int i = 0; i < count; i++) {
    Accessible a = comboBox.getUI().getAccessibleChild(comboBox, i);
    
    if (a instanceof ComboPopup) {
      return ((ComboPopup) a).getList();
    }
  }
  return null;
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

protected static JList getPopupListFor(JComboBox comboBox) {
  int count = comboBox.getUI().getAccessibleChildrenCount(comboBox);
  for (int i = 0; i < count; i++) {
    Accessible a = comboBox.getUI().getAccessibleChild(comboBox, i);
    
    if (a instanceof ComboPopup) {
      return ((ComboPopup) a).getList();
    }
  }
  return null;
}

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

protected static JList getPopupListFor(JComboBox comboBox) {
  int count = comboBox.getUI().getAccessibleChildrenCount(comboBox);
  for (int i = 0; i < count; i++) {
    Accessible a = comboBox.getUI().getAccessibleChild(comboBox, i);
    
    if (a instanceof ComboPopup) {
      return ((ComboPopup) a).getList();
    }
  }
  return null;
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

private static JList getPopupList( JComboBox combo ) {
    Accessible a = combo.getUI().getAccessibleChild(combo, 0);

    if( a instanceof ComboPopup ) {
      return ((ComboPopup) a).getList();
    }
    return null;
  }
}

代码示例来源:origin: tmyroadctfig/swingx

/**
 * Private constructor so users use the more action-oriented
 * {@link #install} method.
 */
private MacOSXPopupLocationFix(JComboBox comboBox) {
  this.comboBox = comboBox;
  this.popupMenu = (JPopupMenu)comboBox.getUI().getAccessibleChild(comboBox, 0);
  
  popupMenu.addPopupMenuListener(listener);
}

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java16

/**
 * Private constructor so users use the more action-oriented
 * {@link #install} method.
 */
private ComboBoxPopupLocationFix(JComboBox comboBox) {
  this.comboBox = comboBox;
  this.popupMenu = (JPopupMenu)comboBox.getUI().getAccessibleChild(comboBox, 0);
  popupMenu.addPopupMenuListener(listener);
}

代码示例来源:origin: com.haulmont.thirdparty/glazedlists

/**
 * Private constructor so users use the more action-oriented
 * {@link #install} method.
 */
private ComboBoxPopupLocationFix(JComboBox comboBox) {
  this.comboBox = comboBox;
  this.popupMenu = (JPopupMenu)comboBox.getUI().getAccessibleChild(comboBox, 0);
  popupMenu.addPopupMenuListener(listener);
}

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java15

/**
 * Private constructor so users use the more action-oriented
 * {@link #install} method.
 */
private ComboBoxPopupLocationFix(JComboBox comboBox) {
  this.comboBox = comboBox;
  this.popupMenu = (JPopupMenu)comboBox.getUI().getAccessibleChild(comboBox, 0);
  popupMenu.addPopupMenuListener(listener);
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

/**
 * Private constructor so users use the more action-oriented
 * {@link #install} method.
 */
private MacOSXPopupLocationFix(JComboBox comboBox) {
  this.comboBox = comboBox;
  this.popupMenu = (JPopupMenu)comboBox.getUI().getAccessibleChild(comboBox, 0);
  
  popupMenu.addPopupMenuListener(listener);
}

代码示例来源:origin: org.swinglabs.swingx/swingx-all

/**
 * Private constructor so users use the more action-oriented
 * {@link #install} method.
 */
private MacOSXPopupLocationFix(JComboBox comboBox) {
  this.comboBox = comboBox;
  this.popupMenu = (JPopupMenu)comboBox.getUI().getAccessibleChild(comboBox, 0);
  
  popupMenu.addPopupMenuListener(listener);
}

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

public void popupMenuWillBecomeVisible(PopupMenuEvent e)
 {
  JComboBox comboBox = (JComboBox) e.getSource();
  Object popup = comboBox.getUI().getAccessibleChild(comboBox, 0);
  Component c = ((Container) popup).getComponent(0);
  if (c instanceof JScrollPane)
  {
    JScrollPane scrollpane = (JScrollPane) c;
    JScrollBar scrollBar = scrollpane.getVerticalScrollBar();
    Dimension scrollBarDim = new Dimension(SCROLLBAR_WIDTH, scrollBar
       .getPreferredSize().height);
    scrollBar.setPreferredSize(scrollBarDim);
  }
 }

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

public void actionPerformed(ActionEvent e)
  {
    JComboBox comboBox= (JComboBox) e.getSource();
    if (comboBox.isEnabled())
    {
      ComboBoxUI ui= (ComboBoxUI) comboBox.getUI();
      if (ui.isPopupVisible(comboBox))
      {
        ui.selectPreviousPossibleValue();
      }
    }
  }
}

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

/**
 * @param sb The combo box we are testing
 * @return The JList component used to display the combobox
 */
public JComponent findPopupFromUI(JComboBox sb) {
  Accessible a = sb.getUI().getAccessibleChild(sb, 0);
  if (a != null && a instanceof javax.swing.plaf.basic.ComboPopup) {
    // get the popup list
    JList list = ((javax.swing.plaf.basic.ComboPopup)a).getList();
    return list;
  }
  return (JList)findPopupComponent(sb);
}

相关文章

JComboBox类方法