6 Replies Latest reply: Mar 14, 2013 7:00 AM by gimbal2 RSS

    Jlist Ram Problem

    996845
      Hey everybody !! :)
      (I'll try to express my problem as best as possible because I'm a french speaker)

      I must realize a software like Music Media Player, ITunes, or others.

      I have an XML file where there are all the items (books).

      Loading all items in once into a Jlist is far of being a solution... if there are 1000 books for example !
      A few people told me : You should load the Jlist step by step when you're scrolling.. but if it's the last element? It'll load again all the file..

      So my questions is : Does someone have a solution or ideas about it?
      How to load smartly a Jlist into memory?
        • 1. Re: Jlist Ram Problem
          Kayaman
          1000 items in a JList wouldn't be a problem memorywise, but it might make the UI look ugly.

          What about using a JTable instead? That way you could display more information as well.
          • 2. Re: Jlist Ram Problem
            996845
            Why wouldn't it be a problem?
            Won't I load too long? What proofs could you give me? :)))

            I can use jtable as well ;) I've done it too with a filtre but only with static data....
            Have you already filled a jtable from an xml file? if so, could you give me an example?

            Thank you already for your answer !
            • 3. Re: Jlist Ram Problem
              Kayaman
              993842 wrote:
              Why wouldn't it be a problem?
              Won't I load too long? What proofs could you give me? :)))
              Si tu veux qu'on t'aide, arrête tes conneries. Si t'as même pas essayé avec 1000 objets dans le JList, c'est pas la peine de discuter ca avec toi.

              Now.
              1000 items is not very much loading wise, but it would probably look bad in a JList. That's why I suggested a JTable.
              I can use jtable as well ;) I've done it too with a filtre but only with static data....
              Filling a JTable is pretty straightforward, whether the data comes from a text file, an XML file, a database or whereever.
              Have you already filled a jtable from an xml file? if so, could you give me an example?
              You'll need to parse the XML (I would suggest SAX) and fill the JTable. You can find plenty of examples on both from Google.
              • 4. Re: Jlist Ram Problem
                996845
                Calm down... ;)

                I just think about it before programming, I don't think it's bad, it's better to search problems before I meet them during the developpement :)
                Thank for your answer and time !
                I'll try it ;)

                Edited by: 993842 on 14 mars 2013 04:34
                • 5. Re: Jlist Ram Problem
                  Kayaman
                  993842 wrote:
                  I just think about it before programming, I don't think it's bad, it's better to search problems before I meet them during the developpement :)
                  Sure, nothing wrong with that. But that doesn't mean that I need to prove it to you that it won't cause a problem.
                  It's the other way around, you prove that there is a problem and then we look for a solution.
                  Thank for your answer and time !
                  No problem.
                  • 6. Re: Jlist Ram Problem
                    gimbal2
                    993842 wrote:
                    Calm down... ;)

                    I just think about it before programming, I don't think it's bad, it's better to search problems before I meet them during the developpement :)
                    Up to a certain point. Its also important to make mistakes and learn from the process of correcting them. Do think about it, but don't be afraid to experiment.