Changeset 5128 in josm for trunk/src


Ignore:
Timestamp:
2012-03-29T10:30:34+02:00 (8 years ago)
Author:
akks
Message:

fix #7450: minor change - better layout tuning for small screens for imagery align nagging panel

File:
1 edited

Legend:

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

    r5119 r5128  
    44import java.awt.Color;
    55import java.awt.Font;
     6import java.awt.GridBagConstraints;
     7import java.awt.GridBagLayout;
    68import java.awt.Toolkit;
    79import java.awt.event.ActionEvent;
     
    1719
    1820import org.openstreetmap.josm.Main;
     21import org.openstreetmap.josm.tools.GBC;
    1922import static org.openstreetmap.josm.tools.I18n.tr;
    2023import org.openstreetmap.josm.tools.ImageProvider;
     
    3033    private static final String PREF = "imagery.offsetnagging";
    3134
    32     public AlignImageryPanel() {
     35    public AlignImageryPanel(boolean oneLine) {
    3336        super();
    3437       
     
    3639        JLabel nagLabel = new JLabel(tr("Aerial imagery might be misaligned. Please check its offset using GPS tracks!"));
    3740        UrlLabel detailsList = new UrlLabel(tr("http://wiki.openstreetmap.org/wiki/Using_Imagery"), tr("Details..."));
    38         double w = Toolkit.getDefaultToolkit().getScreenSize().getWidth();
    39         if (w<1300) detailsList.setDescription("Read more");
    4041        nagLabel.setFont(font);
    4142        detailsList.setFont(font);
     
    5657        });
    5758       
    58         BoxLayout box = new BoxLayout(this, BoxLayout.X_AXIS);
    59         setLayout(box);
    60         add(nagLabel);
    61         add(Box.createHorizontalStrut(12));
    62         add(detailsList);
    63         add(Box.createHorizontalGlue());
    64         add(closeButton);
     59        setLayout(new GridBagLayout());
     60        if (!oneLine) { // tune for small screens
     61            add(nagLabel, GBC.std(1, 1).fill());
     62            add(detailsList, GBC.std(1, 2).fill());
     63            add(closeButton, GBC.std(2, 1).span(1,2).anchor(GBC.EAST));
     64        } else {
     65            add(nagLabel, GBC.std(1,1).fill());
     66            add(detailsList, GBC.std(2,1).fill());
     67            add(closeButton, GBC.std(3,1).anchor(GBC.EAST));
     68        }
    6569//        setBorder(new EmptyBorder(12, 12, 12, 12));
    6670        setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.LOWERED), new EmptyBorder(12, 12, 12, 12)));
     
    7175        if( Main.map != null && !Main.pref.getBoolean("expert") && Main.pref.getBoolean(PREF, true) ) {
    7276            if (Main.map.getTopPanel(AlignImageryPanel.class) == null) {
    73                 AlignImageryPanel p = new AlignImageryPanel();
     77                double w = Toolkit.getDefaultToolkit().getScreenSize().getWidth();
     78                AlignImageryPanel p = new AlignImageryPanel(w>1300);
    7479                Main.map.addTopPanel(p);
    7580            }
Note: See TracChangeset for help on using the changeset viewer.