does the saying "don't optimise" hold true for GUI?

Discussion in 'Java' started by -, Mar 23, 2005.

  1. -

    - Guest

    e.g

    setLocation((int)
    (Toolkit.getDefaultToolkit().getScreenSize().getWidth() /
    getWidth() / 2), (int)
    (Toolkit.getDefaultToolkit().getScreenSize().getHeight() /
    getHeight() / 2));

    or

    Dimension screenSize = (Toolkit.getDefaultToolkit().getScreenSize();
    setLocation((int) screenSize.getWidth() / getWidth() / 2), (int)
    (scrrenSize.getHeight() / getHeight() / 2));
    -, Mar 23, 2005
    #1
    1. Advertising

  2. -

    Angus Parvis Guest

    I'd prefer the seconds version. It's code is shorter and better readable
    than the first one.
    Angus Parvis, Mar 23, 2005
    #2
    1. Advertising

  3. -

    Chris Smith Guest

    - <> wrote:
    > e.g
    >
    > setLocation((int)
    > (Toolkit.getDefaultToolkit().getScreenSize().getWidth() /
    > getWidth() / 2), (int)
    > (Toolkit.getDefaultToolkit().getScreenSize().getHeight() /
    > getHeight() / 2));
    >
    > or
    >
    > Dimension screenSize = (Toolkit.getDefaultToolkit().getScreenSize();
    > setLocation((int) screenSize.getWidth() / getWidth() / 2), (int)
    > (scrrenSize.getHeight() / getHeight() / 2));


    setLocationRelativeTo(null);

    (And yes, I know that's dodging the question. Nevertheless, I think
    there's some kind of lesson here.)

    --
    www.designacourse.com
    The Easiest Way To Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
    Chris Smith, Mar 23, 2005
    #3
  4. -

    - Guest

    Chris Smith wrote:

    > setLocationRelativeTo(null);


    wow... that's a simpler solution. all these while i have been doing it
    the longer way.
    -, Mar 23, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alexey Smirnov
    Replies:
    0
    Views:
    1,019
    Alexey Smirnov
    Feb 26, 2004
  2. Siemel Naran

    Does true ^ true return false?

    Siemel Naran, Jun 17, 2004, in forum: C++
    Replies:
    19
    Views:
    652
    Chris Theis
    Jun 18, 2004
  3. bdb112
    Replies:
    45
    Views:
    1,319
    jazbees
    Apr 29, 2009
  4. Jaydeep Patil

    Hold wxframe (GUI)

    Jaydeep Patil, Mar 26, 2014, in forum: Python
    Replies:
    2
    Views:
    69
    Mark Lawrence
    Mar 26, 2014
  5. Jaydeep Patil
    Replies:
    0
    Views:
    70
    Jaydeep Patil
    Mar 26, 2014
Loading...

Share This Page