Results 1 to 6 of 6
  1. #1
    Parameter is offline Member
    Join Date
    Jun 2012
    Posts
    3
    Rep Power
    0

    Default JList is lost upon adding it to JTabbedPane's panel

    I made a jlist, worked on the normal frame but when I tried to add it to the panel of a jtabbedpane, it suddenly doesn't show up anymore, any specific ways of adding it required or what?

    Thanks in regards

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,038
    Rep Power
    10

    Default Re: JList is lost upon adding it to JTabbedPane's panel

    If you want help, we'll have to see an SSCCE that demonstrates what you're talking about.

    But if I had to guess, I would say that if you're adding a component to an already visible container, you have to revalidate the container.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Parameter is offline Member
    Join Date
    Jun 2012
    Posts
    3
    Rep Power
    0

    Default Re: JList is lost upon adding it to JTabbedPane's panel

    I am currently not at home, so I can't really post any source code, I thought let's just post it because there might be a commonly known solution, when I get back home I will certainly post the code.

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,038
    Rep Power
    10

    Default Re: JList is lost upon adding it to JTabbedPane's panel

    Without knowing the specifics (what layout you're using, whether containers are visible before you're adding to them, etc), it's going to be pretty hard to give you a general solution.

    I would bet that it's one of those two issues (layout or revalidating), but without seeing any code, I can't be sure of which.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

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

    Default Re: JList is lost upon adding it to JTabbedPane's panel

    I would bet that it's one of those two issues
    A third possibility: variable shadowing.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    Parameter is offline Member
    Join Date
    Jun 2012
    Posts
    3
    Rep Power
    0

    Default Re: JList is lost upon adding it to JTabbedPane's panel

    Sorry for not replying, I fixed it already, it was me being stupid not having set the grid layout ;(

Similar Threads

  1. JList does not occupy all the space in the panel.
    By eLancaster in forum New To Java
    Replies: 1
    Last Post: 10-03-2011, 10:07 PM
  2. print multiple panel from JTabbedPane
    By koddy in forum New To Java
    Replies: 5
    Last Post: 06-14-2010, 09:45 AM
  3. JTabbedPane & JList Event Handling
    By MuslimCoder in forum New To Java
    Replies: 2
    Last Post: 10-05-2009, 06:44 AM
  4. Problem Adding Content To JTabbedPane
    By JDCAce in forum AWT / Swing
    Replies: 5
    Last Post: 10-18-2008, 10:45 AM
  5. Adding Tabs to JTabbedPane
    By blackstone in forum AWT / Swing
    Replies: 2
    Last Post: 11-14-2007, 04:15 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
  •