Changeset 1021 in josm


Ignore:
Timestamp:
2008-10-05T16:36:33+02:00 (16 years ago)
Author:
stoecker
Message:

close bug #1606 - preferences display now centered

File:
1 edited

Legend:

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

    r761 r1021  
    4242                dlg.setResizable(true);
    4343
    44                 if (dlg.getWidth() > 600)
    45                         dlg.setSize(600, dlg.getHeight());
    46                 if (dlg.getHeight() > 600)
    47                         dlg.setSize(dlg.getWidth(),600);
     44//              if (dlg.getWidth() > 600)
     45//                      dlg.setSize(600, dlg.getHeight());
     46//              if (dlg.getHeight() > 600)
     47//                      dlg.setSize(dlg.getWidth(),600);
     48
     49                int JOSMWidth = Main.parent.getWidth();
     50                int JOSMHeight = Main.parent.getHeight();
     51
     52                if (JOSMWidth > 2000 && JOSMWidth >  JOSMHeight * 2)
     53                        // don't center on horizontal span monitor configurations (yes, can be selfish sometimes)
     54                        JOSMWidth /= 2;
     55
     56                int targetWidth = JOSMWidth / 2;
     57                if (targetWidth < 600) targetWidth = 600;
     58                if (targetWidth > 1200) targetWidth = 1200;
     59                int targetHeight = (JOSMHeight * 3) / 4;
     60                if (targetHeight < 600) targetHeight = 600;
     61                if (targetHeight > 1200) targetHeight = 1200;
     62
     63                int targetX = Main.parent.getX() + JOSMWidth / 2 - targetWidth / 2;
     64                int targetY = Main.parent.getY() + JOSMHeight / 2 - targetHeight / 2;
     65
     66                dlg.setBounds(targetX, targetY, targetWidth, targetHeight);
    4867
    4968                dlg.setVisible(true);
Note: See TracChangeset for help on using the changeset viewer.