Changeset 8692 in josm for trunk


Ignore:
Timestamp:
2015-08-25T02:32:50+02:00 (9 years ago)
Author:
Don-vip
Message:

see #11795 - fix HeadlessException with Jenkins

File:
1 edited

Legend:

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

    r8510 r8692  
    33
    44import java.awt.Component;
     5import java.awt.GraphicsEnvironment;
    56import java.awt.event.ActionEvent;
    67import java.awt.event.ActionListener;
     
    9899    }
    99100
     101    /**
     102     * Constructs a new {@code PleaseWaitProgressMonitor}.
     103     */
    100104    public PleaseWaitProgressMonitor() {
    101105        this("");
    102106    }
    103107
     108    /**
     109     * Constructs a new {@code PleaseWaitProgressMonitor}.
     110     */
    104111    public PleaseWaitProgressMonitor(String windowTitle) {
    105112        this(Main.parent);
     
    107114    }
    108115
     116    /**
     117     * Constructs a new {@code PleaseWaitProgressMonitor}.
     118     */
    109119    public PleaseWaitProgressMonitor(Component dialogParent) {
    110120        super(new CancelHandler());
    111         this.dialogParent = JOptionPane.getFrameForComponent(dialogParent);
     121        if (GraphicsEnvironment.isHeadless()) {
     122            this.dialogParent = dialogParent;
     123        } else {
     124            this.dialogParent = JOptionPane.getFrameForComponent(dialogParent);
     125        }
    112126        this.cancelable = true;
    113127    }
    114128
     129    /**
     130     * Constructs a new {@code PleaseWaitProgressMonitor}.
     131     */
    115132    public PleaseWaitProgressMonitor(Component dialogParent, String windowTitle) {
    116133        this(JOptionPane.getFrameForComponent(dialogParent));
Note: See TracChangeset for help on using the changeset viewer.