當前位置: 首頁>>代碼示例>>Java>>正文


Java BasicComboPopup.getList方法代碼示例

本文整理匯總了Java中javax.swing.plaf.basic.BasicComboPopup.getList方法的典型用法代碼示例。如果您正苦於以下問題:Java BasicComboPopup.getList方法的具體用法?Java BasicComboPopup.getList怎麽用?Java BasicComboPopup.getList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.plaf.basic.BasicComboPopup的用法示例。


在下文中一共展示了BasicComboPopup.getList方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: lookupPopupItem

import javax.swing.plaf.basic.BasicComboPopup; //導入方法依賴的package包/類
private int lookupPopupItem(String pattern, boolean select) {
    BasicComboPopup popup = (BasicComboPopup) comboBox.getAccessibleContext().getAccessibleChild(0);
    JList list = popup.getList();
    int nextMatch = list.getNextMatch(pattern, 0, Position.Bias.Forward);
    if (list.getSelectedIndex() > 0) {
        nextMatch = nextMatch < 0 ? list.getNextMatch(pattern, list.getSelectedIndex(), Position.Bias.Backward) : nextMatch;
    }
    if (select) {
        if (nextMatch >= 0) {
            list.ensureIndexIsVisible(nextMatch);
            list.setSelectedIndex(nextMatch);
        } else {
            list.getSelectionModel().clearSelection();
        }
    }
    return nextMatch;
}
 
開發者ID:vkravets,項目名稱:FileTemplatesVariable,代碼行數:18,代碼來源:AutoCompletion.java

示例2: popupWider

import javax.swing.plaf.basic.BasicComboPopup; //導入方法依賴的package包/類
private void popupWider(BasicComboPopup popup) {
    @SuppressWarnings("unchecked")
    JList<E> list = popup.getList();

    //  Determine the maximimum width to use:
    //  a) determine the popup preferred width
    //  b) limit width to the maximum if specified
    //  c) ensure width is not less than the scroll pane width

    int popupWidth = list.getPreferredSize().width
            + 5  // make sure horizontal scrollbar doesn't appear
            + getScrollBarWidth(popup, scrollPane);

    if (maximumWidth != -1) {
        popupWidth = Math.min(popupWidth, maximumWidth);
    }

    Dimension scrollPaneSize = scrollPane.getPreferredSize();
    popupWidth = Math.max(popupWidth, scrollPaneSize.width);

    //  Adjust the width

    scrollPaneSize.width = popupWidth;
    scrollPane.setPreferredSize(scrollPaneSize);
    scrollPane.setMaximumSize(scrollPaneSize);
}
 
開發者ID:theaidenlab,項目名稱:Juicebox,代碼行數:27,代碼來源:BoundsPopupMenuListener.java

示例3: popupWider

import javax.swing.plaf.basic.BasicComboPopup; //導入方法依賴的package包/類
protected void popupWider(BasicComboPopup popup) {
	JList list = popup.getList();

	// Determine the maximimum width to use:
	// a) determine the popup preferred width
	// b) limit width to the maximum if specified
	// c) ensure width is not less than the scroll pane width

	int popupWidth = list.getPreferredSize().width + 5 // make sure horizontal scrollbar doesn't appear
			+ getScrollBarWidth(popup, scrollPane);

	if (maximumWidth != -1) {
		popupWidth = Math.min(popupWidth, maximumWidth);
	}

	Dimension scrollPaneSize = scrollPane.getPreferredSize();
	popupWidth = Math.max(popupWidth, scrollPaneSize.width);

	// Adjust the width

	scrollPaneSize.width = popupWidth;
	scrollPane.setPreferredSize(scrollPaneSize);
	scrollPane.setMaximumSize(scrollPaneSize);
}
 
開發者ID:PGWelch,項目名稱:com.opendoorlogistics,代碼行數:25,代碼來源:BoundsPopupMenuListener.java

示例4: updateStateBoxColor

import javax.swing.plaf.basic.BasicComboPopup; //導入方法依賴的package包/類
/**
 * Updates the color of the user state combo box
 */
private void updateStateBoxColor(){
        ComboUserState.setForeground(state_colors[ComboUserState.getSelectedIndex()]);
        Object child = ComboUserState.getAccessibleContext().getAccessibleChild(0);
        BasicComboPopup popup = (BasicComboPopup)child;
        JList list = popup.getList();
        list.setSelectionForeground(state_colors[ComboUserState.getSelectedIndex()]);
        list.setSelectionBackground(Color.WHITE);
}
 
開發者ID:jlsuarezdiaz,項目名稱:NoMoreDropboxMSN,代碼行數:12,代碼來源:MSNView.java

示例5: getScrollPane

import javax.swing.plaf.basic.BasicComboPopup; //導入方法依賴的package包/類
private JScrollPane getScrollPane(BasicComboPopup popup) {
    @SuppressWarnings("unchecked")
    JList<E> list = popup.getList();
    Container c = SwingUtilities.getAncestorOfClass(JScrollPane.class, list);

    return (JScrollPane) c;
}
 
開發者ID:theaidenlab,項目名稱:Juicebox,代碼行數:8,代碼來源:BoundsPopupMenuListener.java

示例6: horizontalScrollBarWillBeVisible

import javax.swing.plaf.basic.BasicComboPopup; //導入方法依賴的package包/類
private boolean horizontalScrollBarWillBeVisible(BasicComboPopup popup, JScrollPane scrollPane) {
    @SuppressWarnings("unchecked")
    JList<E> list = popup.getList();
    int scrollBarWidth = getScrollBarWidth(popup, scrollPane);
    int popupWidth = list.getPreferredSize().width + scrollBarWidth;

    return popupWidth > scrollPane.getPreferredSize().width;
}
 
開發者ID:theaidenlab,項目名稱:Juicebox,代碼行數:9,代碼來源:BoundsPopupMenuListener.java

示例7: horizontalScrollBarWillBeVisible

import javax.swing.plaf.basic.BasicComboPopup; //導入方法依賴的package包/類
protected boolean horizontalScrollBarWillBeVisible(BasicComboPopup popup, JScrollPane scrollPane) {
	JList list = popup.getList();
	int scrollBarWidth = getScrollBarWidth(popup, scrollPane);
	int popupWidth = list.getPreferredSize().width + scrollBarWidth;

	return popupWidth > scrollPane.getPreferredSize().width;
}
 
開發者ID:PGWelch,項目名稱:com.opendoorlogistics,代碼行數:8,代碼來源:BoundsPopupMenuListener.java

示例8: setComboBoxSelectionColor

import javax.swing.plaf.basic.BasicComboPopup; //導入方法依賴的package包/類
public static void setComboBoxSelectionColor(JComboBox comboBox, Color color) {
	Object child = comboBox.getAccessibleContext().getAccessibleChild(0);
	BasicComboPopup popup = (BasicComboPopup)child;
	JList list = popup.getList();
	list.setSelectionForeground(color);
}
 
開發者ID:WorldGrower,項目名稱:WorldGrower,代碼行數:7,代碼來源:SwingUtils.java

示例9: getScrollPane

import javax.swing.plaf.basic.BasicComboPopup; //導入方法依賴的package包/類
protected JScrollPane getScrollPane(BasicComboPopup popup) {
	JList list = popup.getList();
	Container c = SwingUtilities.getAncestorOfClass(JScrollPane.class, list);

	return (JScrollPane) c;
}
 
開發者ID:PGWelch,項目名稱:com.opendoorlogistics,代碼行數:7,代碼來源:BoundsPopupMenuListener.java

示例10: updateModel

import javax.swing.plaf.basic.BasicComboPopup; //導入方法依賴的package包/類
public void updateModel(final SuggestionComboBox comboBox) {
	final Object selected = getValue();

	ProgressThread t = new ProgressThread("fetching_suggestions") {

		@Override
		public void run() {
			try {
				getProgressListener().setTotal(100);
				getProgressListener().setCompleted(0);

				synchronized (lock) {
					removeAllElements();

					insertElementAt(LOADING, 0);

					// fill list with stuff
					List<Object> suggestions = getSuggestions(operator, getProgressListener());

					removeAllElements();

					int index = 0;
					for (Object suggestion : suggestions) {
						insertElementAt(suggestion, index);
						++index;
					}

					// resize popup
					Object child = comboBox.getAccessibleContext().getAccessibleChild(0);
					BasicComboPopup popup = (BasicComboPopup) child;
					JList list = popup.getList();
					Dimension preferred = list.getPreferredSize();
					preferred.width += 25;
					int itemCount = comboBox.getItemCount();
					int rowHeight = 10;
					if(itemCount > 0) {
						rowHeight = preferred.height / itemCount;
					} 
					int maxHeight = comboBox.getMaximumRowCount() * rowHeight;
					preferred.height = Math.min(preferred.height, maxHeight);

					Container c = SwingUtilities.getAncestorOfClass(JScrollPane.class, list);
					JScrollPane scrollPane = (JScrollPane) c;

					scrollPane.setPreferredSize(preferred);
					scrollPane.setMaximumSize(preferred);

					Dimension popupSize = popup.getSize();
					popupSize.width = preferred.width;
					popupSize.height = preferred.height + 5;
					Component parent = popup.getParent();
					if (parent != null) {
						parent.setSize(popupSize);
						parent.validate();
						parent.repaint();
					}
				}

				getProgressListener().setCompleted(100);
				if (getSelectedItem() == null) {
					if (model.getSize() == 0) {
						setSelectedItem(null);
					} else if (selected != null) {
						setSelectedItem(selected);
					}
				}
			} finally {
				getProgressListener().complete();
			}
		}
	};
	t.start();
}
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:74,代碼來源:AbstractSuggestionBoxValueCellEditor.java


注:本文中的javax.swing.plaf.basic.BasicComboPopup.getList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。