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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:50:56+00:00 2026-05-31T03:50:56+00:00

Update: I’ve found a partial solution in this answer here , by adding the

  • 0

Update:

I’ve found a partial solution in this answer here, by adding the following code:

class CustomRenderer extends DefaultTableCellRenderer 
{
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
    {
        Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
        c.setBackground(new java.awt.Color(255, 72, 72));
        return c;
    }
}

And then passing it to my JTable object:

jTable2.setDefaultRenderer(String.class, new CustomRenderer());

This works correctly and now the table rows are coloured red:

Psuedocode Panel

The only thing I need to know now is how to restrict the colouring to a single row and a single cell.

After further research I need a setCellRender() method so that I can set the custom render on a particular cell, but this method doesn’t exist.


Question:

I want to create a visual component of step-by-step pseudocode execution.

To do this I have created a JTable and now I am looking for ways to highlight each row (or cell since there is only one column) to display which line is being executed.

I’ve included a mockup below on the final GUI. As you can see in the Pseudocode panel I’ve highlighted the final row.

Please ignore the arrows they are not strictly related to the question.

Wireframe

I’ve started to implement the mockup in Netbeans Matisse (this is 1 of 3 algorithms). However I don’t know how to highlight the single line code line 1 in the JTable component.

Would it be easier to use a different type of component?

Later I’ll also need to be able to re-color individual cells as show in the mockup’s Table JPanel. How can this be implemented?

Partial implementation

  • 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-31T03:50:57+00:00Added an answer on May 31, 2026 at 3:50 am

    1) use JTextPane for supporting styled text, there you have three choices

    • use HighLighter

    • use Html formatted text (Java6 in current form supporting <= Html3.2 and with reduced supporting of css, sure in compare with Html5)

    • combine both a.m. options together

    • write own EditorKit or HtmlEditorKit (thanks to @stryba)

    2) for JTable pass desired value to the prepareRenderer() rather than implement getTableCellRendererComponent()

    3) if value for JSlider is modifiable (from another JComponents) then look for BoundedRangeModel

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

Sidebar

Related Questions

Update : I found the solution by removing v.setFocusable(true); v.setClickable(true); in the code and
UPDATE : The full site code is here - https://github.com/eWizardII/PeerInstruction I have the following
Update: This does work, I was being stupid :( i have the following extension
Update: Solved, with code I got it working, see my answer below for the
UPDATE - A comprehensive comparison, updated as of February 2015, can be found here:
Update Sir this is current code of my web page.I made changes according to
Update 2 : Found the forward declare bug that caused this Update : Compiled
UPDATE: Solution found UPDATE: No proposed answers. No solution found on my end. Anybody?
Update In the wiki spirit of StackOverflow, here's an update: I spiked Joe White's
UPDATE!!! Suggested answer is NOT correct, my mistake. The #container DIV should've had float:left;.

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.