Page 2 of 2 FirstFirst 12
Results 21 to 30 of 30

Thread: reference issue

  1. #21
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by Stephen Douglas View Post
    one last question on this post.. How you people have expert answers to every questions.. Since how long are you working in Java??
    An "expert" is anyone who knows a little bit more than you do. And I mean "you" in the general sense. So for example to you since you're just starting, I'm an expert, but to Phil, Eranga, Rob Camickr, and the other pros, I'm not.

    By the way, obviuosly i respect your recommendation. but how can i extract components?
    getSelectedComponent returns whatever component the JTabbedPane is currently displaying, and in your code will return the JScrollPane, from this you can get the JScrollPane's JViewport and what the view port holds. You should be able to figure it out from there.

  2. #22
    Stephen Douglas's Avatar
    Stephen Douglas is offline Senior Member
    Join Date
    Mar 2010
    Posts
    137
    Rep Power
    0

    Default

    Hi.. the problem is not over yet.. I am able to refer to every panel created using changeListener but the problem is that..

    since the first panel is created first and the second panel is created at last.. so the refernce that is available is of the second panel after the frame is executed for the first time.. so when i try to make modifications to the table added to first panel , say table1 the modificaions are not implemented.. but when i switch to panel2 and then return to panel1 and then make modifications to table1 ... modifications are implemented..

    bottom line: i need to switch to some other panel and then return to the first panel in order to make changelistener to come to life..

    please suggest.. i am using tablemodellistener as anonymous inner class inside the change listener.
    The Quieter you become the more you are able to hear !

  3. #23
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    One possible solution is to do just that: change the tabs programmatically after adding the change listener.

  4. #24
    Stephen Douglas's Avatar
    Stephen Douglas is offline Senior Member
    Join Date
    Mar 2010
    Posts
    137
    Rep Power
    0

    Default

    i didn't get it.. please explain.
    The Quieter you become the more you are able to hear !

  5. #25
    Stephen Douglas's Avatar
    Stephen Douglas is offline Senior Member
    Join Date
    Mar 2010
    Posts
    137
    Rep Power
    0

    Default

    How can i change the tab? please explain.
    The Quieter you become the more you are able to hear !

  6. #26
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Have a look in the JTabbedPane API. Often for many getter methods (int getFoo()), there's an associated setter method (setFoo(int value)). You are using some getter methods one of whose associated setter method could be useful.

  7. #27
    Stephen Douglas's Avatar
    Stephen Douglas is offline Senior Member
    Join Date
    Mar 2010
    Posts
    137
    Rep Power
    0

    Default

    jTabbedPane1.setSelectedIndex(0);
    or jTabbedPane1.setSelectedIndex(1);

    are setting panel 0 or panel1 to front but i am not able to refer to panel0..

    please help.
    The Quieter you become the more you are able to hear !

  8. #28
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Try setting it to 1 and then back to 0.

  9. #29
    Stephen Douglas's Avatar
    Stephen Douglas is offline Senior Member
    Join Date
    Mar 2010
    Posts
    137
    Rep Power
    0

    Default

    Ha.. It work'd thanks. thankyou so much.
    The Quieter you become the more you are able to hear !

  10. #30
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

Page 2 of 2 FirstFirst 12

Similar Threads

  1. persistent of same reference twice
    By smackdown90 in forum Web Frameworks
    Replies: 0
    Last Post: 04-25-2010, 07:53 PM
  2. Object and reference
    By katie in forum New To Java
    Replies: 2
    Last Post: 10-19-2009, 04:45 PM
  3. creating a reference to a value in a map
    By kellykellykelly in forum Advanced Java
    Replies: 1
    Last Post: 02-28-2009, 08:59 AM
  4. removing reference
    By ajith_raj in forum Advanced Java
    Replies: 4
    Last Post: 02-12-2009, 12:46 PM
  5. Getting the Object Reference Name
    By Deathmonger in forum New To Java
    Replies: 2
    Last Post: 03-12-2008, 03:51 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
  •