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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:27:19+00:00 2026-06-09T13:27:19+00:00

I have a JTable which contains a one column, cell render of each table

  • 0

I have a JTable which contains a one column, cell render of each table cell is dynamically generated JPanel therefore each table cell height should be different according to its JPanel, I have tried to change the row height at the place where the jpanel is rendered but it is not working. please tell me how to set different JTable row heights in a JTable,

this is how I tried to do this,

    private QCellPanel renderer = new QCellPanel();
    private QCellPanel editor = new QCellPanel();

    @Override
    public Object getCellEditorValue() {
        return editor.getQuestion();
    }

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        renderer.setQuestion((Qusetion) value);

        table.setRowHeight(renderer.getPreferredSize().height);
        return renderer;
    }

    @Override
    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
        editor.setQuestion((Qusetion) value);
        table.setRowHeight(editor.getPreferredSize().height);
        return editor;
    }
  • 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-06-09T13:27:20+00:00Added an answer on June 9, 2026 at 1:27 pm

    You need to use the two-argument version setRowHeight(rowNumber, height).

    If possible, you should also avoid changing the row height in the getXComponent methods, as setRowHeight forces the table to be redrawn, which will cause it to ask for a renderer component again, etc… The default implementation is probably smart enough to not trigger this as long as the height is stable, but if you end up with infinite loops this is were I’d look first 🙂

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

Sidebar

Related Questions

I have a JTable . One column holds a JPanel which contains some JLabels
I have a table which contains delete buttons for each row. I use int
I have a JTable of which one column is pre-filled with 30min time slots
Hi I an issue with editors in a JTable. I have a column which
I have a JTable where the first column in each row is a checkbox.
I have the following JTable which uses a table model: http://s17.postimage.org/7zfh3l4lr/Screen_Shot_2012_03_10_at_15_11_31.png Instead of using,
We have a Java Swing application which contains components like JTable, JCombobox, JTextArea and
I have created a JTable, the table contains 4 rows, and for a specific
I have a JTable with 3 column of which first column is a button
I have jFrame2 which contains jTable with 4 columns (the jTable taking data from

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.