Java Code Examples for javax.swing.plaf.basic.BasicComboPopup#getInvoker()
The following examples show how to use
javax.swing.plaf.basic.BasicComboPopup#getInvoker() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BoundsPopupMenuListener.java From Juicebox with MIT License | 6 votes |
private void customizePopup(BasicComboPopup popup) { scrollPane = getScrollPane(popup); if (popupWider) popupWider(popup); checkHorizontalScrollBar(popup); // For some reason in JDK7 the popup will not display at its preferred // width unless its location has been changed from its default // (ie. for normal "pop down" shift the popup and reset) Component comboBox = popup.getInvoker(); Point location = comboBox.getLocationOnScreen(); if (popupAbove) { int height = popup.getPreferredSize().height; popup.setLocation(location.x, location.y - height); } else { //int height = comboBox.getPreferredSize().height; //popup.setLocation(location.x, location.y + height - 1); //popup.setLocation(location.x, location.y + height); //TODO should not be hardcoded popup.setLocation(location.x + 5, location.y + 35); } }
Example 2
Source File: BoundsPopupMenuListener.java From openAGV with Apache License 2.0 | 5 votes |
protected void customizePopup(BasicComboPopup popup) { scrollPane = getScrollPane(popup); popupWider(popup); // For some reason in JDK7 the popup will not display at its preferred // width unless its location has been changed from its default // (ie. for normal "pop down" shift the popup and reset) Component comboBox = popup.getInvoker(); Point location = comboBox.getLocationOnScreen(); int height = comboBox.getSize().height; popup.setLocation(location.x, location.y + height - 1); popup.setLocation(location.x, location.y + height); }
Example 3
Source File: BoundsPopupMenuListener.java From openAGV with Apache License 2.0 | 5 votes |
protected int getScrollBarWidth(BasicComboPopup popup, JScrollPane scrollPane) { // I can't find any property on the scrollBar to determine if it will be // displayed or not so use brute force to determine this. JComboBox<?> comboBox = (JComboBox) popup.getInvoker(); if (comboBox.getItemCount() > comboBox.getMaximumRowCount()) { return scrollPane.getVerticalScrollBar().getPreferredSize().width; } else { return 0; } }
Example 4
Source File: BoundsPopupMenuListener.java From Juicebox with MIT License | 5 votes |
private int getScrollBarWidth(BasicComboPopup popup, JScrollPane scrollPane) { int scrollBarWidth = 0; @SuppressWarnings("unchecked") JComboBox<E> comboBox = (JComboBox<E>) popup.getInvoker(); if (comboBox.getItemCount() > comboBox.getMaximumRowCount()) { JScrollBar vertical = scrollPane.getVerticalScrollBar(); scrollBarWidth = vertical.getPreferredSize().width; } return scrollBarWidth; }