Ignore:
Timestamp:
2014-05-08T02:40:40+02:00 (10 years ago)
Author:
Don-vip
Message:

Robustness to allow to run more unit tests in headless mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java

    r7005 r7075  
    66
    77import java.awt.Component;
     8import java.awt.GraphicsEnvironment;
    89import java.awt.MenuComponent;
    910import java.awt.Toolkit;
     
    104105        MainMenu.add(subMenu, rectaction);
    105106    }
    106    
     107
    107108    private void setupMenuScroller() {
    108         int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
    109         int menuItemHeight = singleOffset.getPreferredSize().height;
    110         MenuScroller.setScrollerFor(this, (screenHeight / menuItemHeight)-1);
     109        if (!GraphicsEnvironment.isHeadless()) {
     110            int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
     111            int menuItemHeight = singleOffset.getPreferredSize().height;
     112            MenuScroller.setScrollerFor(this, (screenHeight / menuItemHeight)-1);
     113        }
    111114    }
    112115
     
    234237
    235238    /**
    236      * Collection to store temporary menu items. They will be deleted 
     239     * Collection to store temporary menu items. They will be deleted
    237240     * (and possibly recreated) when refreshImageryMenu() is called.
    238241     * @since 5803
    239242     */
    240243    private List <Object> dynamicItems = new ArrayList<>(20);
    241    
     244
    242245    /**
    243246     * Remove all the items in @field dynamicItems collection
     
    264267        add(s);
    265268    }
    266    
     269
    267270    private void addDynamic(Action a) {
    268271        dynamicItems.add( this.add(a) );
    269272    }
    270    
     273
    271274    private void addDynamic(JMenuItem it) {
    272275        dynamicItems.add( this.add(it) );
Note: See TracChangeset for help on using the changeset viewer.