How heavy is a JPanel?

Discussion in 'Java' started by Timasmith, Nov 15, 2006.

  1. Timasmith

    Timasmith Guest

    In terms of performance not pounds, when it comes to layout managers,
    resources et al.

    As an example I want to have a comboxbox and an elipsis ... button
    treated as a single control.

    If I use a JPanel + BorderLayout with a combobox using the 'Center' and
    the button the 'East'

    [________] [...]

    To make it look good I dont want the button to take up the entire East,
    rather be laid out in a 'Flowlayout' fashion. To achieve this I need
    to add an extra JPanel.

    Will that add much overhead if I have forms with 10-20 comboboxes
    routinely displayed?
    Timasmith, Nov 15, 2006
    #1
    1. Advertising

  2. Timasmith schrieb:
    > As an example I want to have a comboxbox and an elipsis ... button
    > treated as a single control.
    >
    > If I use a JPanel + BorderLayout with a combobox using the 'Center' and
    > the button the 'East'
    >
    > [________] [...]
    >
    > To make it look good I dont want the button to take up the entire East,
    > rather be laid out in a 'Flowlayout' fashion. To achieve this I need
    > to add an extra JPanel.


    No, you need not. You simply need another LayoutManager. Try JGoodies
    FormsLayout e.g.

    >
    > Will that add much overhead if I have forms with 10-20 comboboxes
    > routinely displayed?


    Sure, but I'm unsure if you can see or feel this overhead while running :)

    Bye
    Michael
    Michael Rauscher, Nov 15, 2006
    #2
    1. Advertising

  3. Michael Rauscher schreef:
    > Timasmith schrieb:
    >>
    >> Will that add much overhead if I have forms with 10-20 comboboxes
    >> routinely displayed?

    >
    > Sure, but I'm unsure if you can see or feel this overhead while running :)
    >


    I agree with Michael. It's like another Michael once said (no, no, not
    that one...):

    "The First Rule of Program Optimization: Don't do it. The Second Rule of
    Program Optimization (for experts only!): Don't do it yet."
    - Michael A. Jackson

    CHeeRs,
    Peter
    Peter Van Weert, Nov 15, 2006
    #3
  4. "Timasmith" <> wrote in message
    news:...
    > In terms of performance not pounds, when it comes to layout managers,
    > resources et al.
    >
    > As an example I want to have a comboxbox and an elipsis ... button
    > treated as a single control.
    >
    > If I use a JPanel + BorderLayout with a combobox using the 'Center' and
    > the button the 'East'
    >
    > [________] [...]
    >
    > To make it look good I dont want the button to take up the entire East,
    > rather be laid out in a 'Flowlayout' fashion. To achieve this I need
    > to add an extra JPanel.
    >
    > Will that add much overhead if I have forms with 10-20 comboboxes
    > routinely displayed?
    >

    The easiest way to do this is to write your own EllipsisCombo component,
    extending JPanel, and containing a JComboBox and a JButton that you
    place explicitly.

    --
    Fred L. Kleinschmidt
    Boeing Associate Technical Fellow
    Technical Architect, Software Reuse Project
    Fred Kleinschmidt, Nov 15, 2006
    #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. news.microsoft.com

    HTTPHandler 404 Under Heavy Load

    news.microsoft.com, Jun 16, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    471
    Darren Clark
    Jul 21, 2004
  2. Minti
    Replies:
    4
    Views:
    842
    John C. Bollinger
    Feb 12, 2004
  3. Andreas Beresko

    Add a JPanel to a JPanel...

    Andreas Beresko, Jul 14, 2004, in forum: Java
    Replies:
    6
    Views:
    26,971
  4. Raphael Jolivet

    [JPanel] Drop Down JPanel

    Raphael Jolivet, Jul 18, 2008, in forum: Java
    Replies:
    1
    Views:
    1,512
    John B. Matthews
    Jul 18, 2008
  5. t1m1976
    Replies:
    1
    Views:
    2,398
    t1m1976
    Nov 7, 2010
Loading...

Share This Page