Results 1 to 4 of 4
  1. #1
    namreen is offline Member
    Join Date
    Aug 2010
    Posts
    7
    Rep Power
    0

    Default jpanel getcomponent in order to they are placed

    hi all,
    how to get the components from the jpanel in order they are placed. jpanel.getcomponents() is giving me the controls present on it but it is giving in different order. e.g. it is giving me 5 labels,then 2 textboxes etc. i am plaing label with textbox so it should give me one label , then one textfield then another. please help me. i m stuck.
    thanks in advance.

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    6

    Default

    if there is no other method in the API(I dont know if getComponent(int n) - has a other order) you could add the components to a list too, e.g. ArrayList.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default

    i am plaing label with textbox
    If that means what I think it might, you may want to take a look at JLabel#setLabelFor(...)

    db

  4. #4
    namreen is offline Member
    Join Date
    Aug 2010
    Posts
    7
    Rep Power
    0

    Default

    Thankx for reply.
    My controls are at design time. in between some controls i want to add control. for that reason i wanted the getcomponent to return controls as they are at design time. can u help me please?
    thanks once again

Similar Threads

  1. Order of EXECUTION followed by JVM!
    By _ShivamKapoOr_ in forum New To Java
    Replies: 5
    Last Post: 09-24-2010, 10:18 PM
  2. order swings controls in JPanel
    By DiTeN in forum AWT / Swing
    Replies: 2
    Last Post: 06-15-2010, 02:57 PM
  3. How to order a vector?
    By tyang in forum New To Java
    Replies: 2
    Last Post: 02-06-2010, 09:24 AM
  4. Java Run Order
    By collin389 in forum New To Java
    Replies: 15
    Last Post: 11-24-2009, 08:22 AM
  5. Instantiation order
    By Jeremy720 in forum New To Java
    Replies: 3
    Last Post: 07-17-2009, 04:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •