Changeset 12128 in josm


Ignore:
Timestamp:
2017-05-12T20:18:02+02:00 (7 years ago)
Author:
Don-vip
Message:

see #14741 - rework initialization of Main.contentPanePrivate

Location:
trunk
Files:
4 edited

Legend:

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

    r12127 r12128  
    3838import javax.swing.JComponent;
    3939import javax.swing.JOptionPane;
    40 import javax.swing.JPanel;
    4140import javax.swing.KeyStroke;
    4241import javax.swing.LookAndFeel;
     
    208207
    209208    /**
     209     * The private content pane of {@code MainFrame}, required to be static for shortcut handling.
     210     */
     211    protected static JComponent contentPanePrivate;
     212
     213    /**
    210214     * The file watcher service.
    211215     */
     
    637641        }
    638642    }
    639 
    640     protected static final JPanel contentPanePrivate = new JPanel(new BorderLayout());
    641643
    642644    public static void redirectToMainContentPane(JComponent source) {
     
    770772        }
    771773        toolbar = new ToolbarPreferences();
    772         contentPanePrivate.updateUI();
    773774
    774775        UIManager.put("OptionPane.okIcon", ImageProvider.get("ok"));
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r12127 r12128  
    3838
    3939import javax.net.ssl.SSLSocketFactory;
     40import javax.swing.JComponent;
    4041import javax.swing.JOptionPane;
    4142import javax.swing.RepaintManager;
     
    313314                args.getSingle(Option.GEOMETRY).orElse(null),
    314315                !args.hasOption(Option.NO_MAXIMIZE) && Main.pref.getBoolean("gui.maximized", false));
    315         final MainFrame mainFrame = new MainFrame(contentPanePrivate, geometry);
     316        final MainFrame mainFrame = new MainFrame(geometry);
     317        Main.contentPanePrivate = (JComponent) mainFrame.getContentPane();
    316318        Main.mainPanel = mainFrame.getPanel();
    317319        Main.parent = mainFrame;
  • trunk/src/org/openstreetmap/josm/gui/MainFrame.java

    r12127 r12128  
    66import java.awt.BorderLayout;
    77import java.awt.Component;
    8 import java.awt.Container;
    98import java.awt.Image;
    109import java.awt.Rectangle;
     
    5655     */
    5756    public MainFrame() {
    58         this(new JPanel(), new WindowGeometry(new Rectangle(10, 10, 500, 500)));
    59     }
    60 
    61     /**
    62      * Create a new main window. The parameters will be removed in the future.
    63      * @param contentPanePrivate The content
     57        this(new WindowGeometry(new Rectangle(10, 10, 500, 500)));
     58    }
     59
     60    /**
     61     * Create a new main window. The parameter will be removed in the future.
    6462     * @param geometry The inital geometry to use.
    65      * @since 11713
    66      */
    67     public MainFrame(Container contentPanePrivate, WindowGeometry geometry) {
     63     * @since 12127
     64     */
     65    public MainFrame(WindowGeometry geometry) {
    6866        super();
    6967        this.geometry = geometry;
    7068        this.panel = new MainPanel(Main.getLayerManager());
    71         setContentPane(contentPanePrivate);
     69        setContentPane(new JPanel(new BorderLayout()));
    7270    }
    7371
  • trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java

    r12125 r12128  
    66import static org.junit.Assert.fail;
    77
     8import java.awt.BorderLayout;
    89import java.io.File;
    910import java.io.IOException;
     
    1415import java.util.TimeZone;
    1516
     17import javax.swing.JPanel;
     18
    1619import org.openstreetmap.josm.data.projection.Projections;
    1720import org.openstreetmap.josm.gui.MainApplication;
     21import org.openstreetmap.josm.gui.MainPanel;
    1822import org.openstreetmap.josm.gui.layer.LayerManagerTest.TestLayer;
    1923import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;
     
    146150        assertNull(Main.getLayerManager().getActiveLayer());
    147151
     152        if (Main.contentPanePrivate == null) {
     153            Main.contentPanePrivate = new JPanel(new BorderLayout());
     154        }
     155        if (Main.mainPanel == null) {
     156            Main.mainPanel = new MainPanel(Main.getLayerManager());
     157        }
    148158        if (Main.toolbar == null) {
    149159            Main.toolbar = new ToolbarPreferences();
Note: See TracChangeset for help on using the changeset viewer.