Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6862479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:40:00+00:00 2026-05-27T02:40:00+00:00

I’m at a complete loss here. I have a method that goes through a

  • 0

I’m at a complete loss here. I have a method that goes through a Vector of TreePaths containing a custom FileNode class, and extracts the File contained in each last node. The result is a printed list of all the filenames in the Vector. I had a for loop to increment through it, and it worked fine, but I changed it to a while loop to allow me to have multiple pages. Now, for some reason, it only prints the last 11 files.

I’ve figured out what’s causing it, but I don’t know why or how to fix it. I added in lines to print to the console ‘lineCount’ and ‘printPaths.size()’, and discovered that lineCount was incrementing until it hit 55, then reverting to 15 and continuing to increment. The names did not actually start printing until it reverted to 15.

I’ve stepped through it in debug mode, and it goes through the print loop 55 times, returns the code to the print function that tells it it’s part of the printed page, then it drops into a print method for which I don’t have the source, and when I step back up out of that, it is back at the beginning of the loop, and lineCount is at 14. The really odd part is that’s when it prints out the 11 files, even though according to the program it hasn’t even looked at that part of the Vector yet.

If anyone has the slightest idea what’s causing that, I would really appreciate the help. Here’s the chunk of code that deals with printing the list. Hopefully that’s enough.

        lineCount = 13;
    int lineSpacing = 14;
    g.setFont(new Font("Dialog", Font.PLAIN, 10));
    boolean color = true;
    if (summ) {
        g.drawString(((TreePath) printPaths.get(0)).getPathComponent(
                ((TreePath) printPaths.get(0)).getPathCount() - 3)
                .toString()
                + " : "
                + ((TreePath) printPaths.get(0)).getPathComponent(
                        ((TreePath) printPaths.get(0)).getPathCount() - 5)
                        .toString(), 36, lineCount * lineSpacing);
        lineCount++;
        //for (int j = 1; j < printPaths.size(); j++) {
        while((printPaths.size()>1) && lineCount<55){
            String type = ((TreePath) printPaths.get(1)).getPathComponent(
                    ((TreePath) printPaths.get(1)).getPathCount() - 5)
                    .toString();
            String date = ((TreePath) printPaths.get(1)).getPathComponent(
                    ((TreePath) printPaths.get(1)).getPathCount() - 3)
                    .toString();
            String typeU = ((TreePath) printPaths.get(0))
                    .getPathComponent(
                            ((TreePath) printPaths.get(1)).getPathCount() - 5)
                    .toString();
            String dateU = ((TreePath) printPaths.get(0))
                    .getPathComponent(
                            ((TreePath) printPaths.get(1)).getPathCount() - 3)
                    .toString();
            if (!(type == typeU) && (date == dateU)) {
                lineCount++;
                g.setColor(c1);
                g.drawString(date + " : " + type, 36, lineCount
                        * lineSpacing);
                lineCount++;
            }
            if(color)
                g.setColor(c1);
            else
                g.setColor(c2);
            g.drawString(((TreePath) printPaths.get(1))
                    .getLastPathComponent().toString(), 54, lineCount
                    * lineSpacing);
            color=!color;
            lineCount++;
            printPaths.remove(0);
            System.out.println(printPaths.size());
            System.out.println(lineCount);
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:40:00+00:00Added an answer on May 27, 2026 at 2:40 am

    I eventually discovered that Java implements pagination pretty well on its own, without needing the stuff I was trying to do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to loop through a bunch of documents I have to put
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.