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 7574635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:29:01+00:00 2026-05-30T16:29:01+00:00

I have the following Problem: I have a JTable which shows me the progress

  • 0

I have the following Problem:

I have a JTable which shows me the progress of a command. I have 2 sort of commands. Determined and indetermined commands.

If i only have indetermined progressbars in the table the progress is shown correct.
but if i have one determined progressbars in it, the other indetermined wont be animated.

Here is my code:

class ProgressBarRenderer implements TableCellRenderer {

    /** The bar. */
    private JProgressBar bar = new JProgressBar() {
        public boolean isDisplayable() {
            return true;
        };
    };

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        ProgressBarInfo pbi = (ProgressBarInfo) value;
        if (pbi.getType() == Progress.LS) {
            if (pbi.getValue() == -1) {
                bar.setIndeterminate(false);
                bar.setValue(0);
                bar.setString("Progress ended");
            } else {
                bar.setIndeterminate(true);
                bar.setString(pbi.getValue() + " " + pbi.getText());
            }
            bar.setStringPainted(true);

            return bar;
        } else if (pbi.getType() == Progress.SCP) {
            if (pbi.getValue() == -1) {
                bar.setIndeterminate(false);
                bar.setValue(0);
                bar.setString("Progress ended");
            } else {
                bar.setValue(pbi.getValue());
                bar.setString(pbi.getValue() + "% " + pbi.getText());
            }
            bar.setIndeterminate(false);
            bar.setStringPainted(true);
        }
        return bar;
    }
}

The Table is updated every 10 milliseconds by a swingworker thread, so don’t mind about that.

  • 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-30T16:29:02+00:00Added an answer on May 30, 2026 at 4:29 pm

    The internal state of the progressBar (determinate vs. indeterminate) is very different – switching between them on the same instance might be the reason. Try to use one instance for each

    public class MyRenderer ....
        JProgressBar determinate;
        JProgressBar indeterminate; 
    
        public Component getTableCellRendererComponent(...) {
             if (value.isDeterminate) {
               ...
               return determinate;
             }
             ....
             return undeterminate
        } 
    

    Edit

    checked: it is working, though might look a bit weird with many indeterminate cells which are animated “in step”. Just beware: the internal – in the ui delegate – animation state is undocumented, so there might be LAFs where it doesn’t work at all (f.i. Substance, afair).

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

Sidebar

Related Questions

I have the following problem. If I query values with a keyfigure which is
I have the following Problem. Let's Say I have a JTable with the folowing
I have the following problem: I have a JTable inside a JScrollPane, and the
I have following problem that in a transformation (which is completely done in memory)
i have following problem: I have a class Foo which encapsulates a web-api. the
I have following problem: I have a TabActivity which works well. Inside, there is
I have following problem and only could solve it partially yet. I am working
I have following method in my class which extends JTable: protected void setTableCursor(Cursor cursor)
I have following problem: I have built a tabbar application with 4 tabs. I
I have following problem, Code: String a=Yeahh, I have no a idea what's happening

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.