Java 8 PopupMenuEvent - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 PopupMenuEvent class.

This code example shows how to use the following methods:getSource
	boolean stateCmb = false;
	  
	//Extend JComboBox's length and reset it 
	public void popupMenuWillBecomeVisible(PopupMenuEvent e)
	{ 
	  JComboBox cmb = (JComboBox)e.getSource();
	  int oldWidth = cmb.getPreferredSize().width;
	   
	  //Extend JComboBox 
	  cmb.setSize(popupWidth, cmb.getHeight());
	 
	  //If it pops up now JPopupMenu will still be short 
	  //Fire popupMenuCanceled... 
	  if(!stateCmb)
	    cmb.firePopupMenuCanceled();
	   
	  //Reset JComboBox and state 
	  stateCmb = false;
	  cmb.setSize(oldWidth, cmb.getHeight());
	} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getSource
 
    @Override 
    public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
        getModel().setRollover(false);
        getModel().setSelected(false);
        ((JPopupMenu) e.getSource()).removePopupMenuListener(this);
        // remove parent of the radiobutton in actionPeformed() item.getParent() 
        // ((JPopupMenu) e.getSource()).removeAll(); 
    } 
 
    @Override 
    public void popupMenuCanceled(PopupMenuEvent e) {
    } 
 
    public String getType() {
        return type;
    } 
 
    protected abstract JPopupMenu getPopupMenu();
 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getSource
        public void popupMenuCanceled(PopupMenuEvent e) {
        } 
 
        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            if (popupMenuUI.screenImage != null) {
                JPopupMenu popup = (JPopupMenu) e.getSource();
                JRootPane root = popup.getRootPane();
                if (popup.isShowing() && root.isShowing()) {
                    Point ptPopup = popup.getLocationOnScreen();
                    Point ptRoot = root.getLocationOnScreen();
                    Graphics g = popup.getRootPane().getGraphics();
                    g.drawImage(popupMenuUI.screenImage, ptPopup.x - ptRoot.x, ptPopup.y - ptRoot.y, null);
                    popupMenuUI.resetScreenImage();
                } 
            } 
        } 
 
        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
        } 
    } 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getSource
        public void popupMenuCanceled(PopupMenuEvent e) {
        } 
 
        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            if (popupMenuUI.screenImage != null) {
                JPopupMenu popup = (JPopupMenu) e.getSource();
                JRootPane root = popup.getRootPane();
                if (popup.isShowing() && root.isShowing()) {
                    Point ptPopup = popup.getLocationOnScreen();
                    Point ptRoot = root.getLocationOnScreen();
                    Graphics g = popup.getRootPane().getGraphics();
                    g.drawImage(popupMenuUI.screenImage, ptPopup.x - ptRoot.x, ptPopup.y - ptRoot.y, null);
                    popupMenuUI.resetScreenImage();
                } 
            } 
        } 
 
        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
        } 
    } 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 PopupMenuEvent Methods: