Ignore:
Timestamp:
2016-09-04T16:32:05+02:00 (8 years ago)
Author:
Don-vip
Message:

see #13479 - make ConflictResolutionDialog inherit from ExtendedDialog

File:
1 edited

Legend:

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

    r10791 r10957  
    146146    }
    147147
     148    /**
     149     * Same as above but lets you define if the dialog should be disposed on close.
     150     * @param parent The parent element that will be used for position and maximum size
     151     * @param title The text that will be shown in the window titlebar
     152     * @param buttonTexts String Array of the text that will appear on the buttons. The first button is the default one.
     153     * @param modal Set it to {@code true} if you want the dialog to be modal
     154     * @param disposeOnClose whether to call {@link #dispose} when closing the dialog
     155     */
    148156    public ExtendedDialog(Component parent, String title, String[] buttonTexts, boolean modal, boolean disposeOnClose) {
    149157        super(searchRealParent(parent), title, modal ? ModalityType.DOCUMENT_MODAL : ModalityType.MODELESS);
     
    329337
    330338        for (int i = 0; i < bTexts.length; i++) {
    331             final int finalI = i;
    332             Action action = new AbstractAction(bTexts[i]) {
    333                 @Override
    334                 public void actionPerformed(ActionEvent evt) {
    335                     buttonAction(finalI, evt);
    336                 }
    337             };
    338 
    339             button = new JButton(action);
     339            button = new JButton(createButtonAction(i));
    340340            if (i == defaultButtonIdx-1) {
    341341                defaultButton = button;
     
    430430        setSize(d);
    431431        setLocationRelativeTo(parent);
     432    }
     433
     434    protected Action createButtonAction(final int i) {
     435        return new AbstractAction(bTexts[i]) {
     436            @Override
     437            public void actionPerformed(ActionEvent evt) {
     438                buttonAction(i, evt);
     439            }
     440        };
    432441    }
    433442
Note: See TracChangeset for help on using the changeset viewer.