Adjusting row height in JTable

hi:
i think i have a tricky one.. i have a Jtable where the cell renderers extend JTextArea. I set the column width, but because the cells can contain any amount of text, i have to adjust each row width to accomodate the text. i used the FontMetrics methods like stringWidth or getStringBounds to get the width of the string and then divide it by the column width to know how many rows this particualar cell will span, and it is working to some extent by not very accurately. any idea if this is a correct way to do it??
thanks...

not really.. this is already set, but a cell in a JTable doesn't adjust it's rowHeight automatically.. i had to loop thru all of the rows to do that myself.. any other suggestions??

Similar Messages

  • Can we adjust ROW height in ALV report as like of Excel ?

    Dear all,
    Can we adjust ROW height in ALV report as like of Excel sheet ?
    Can we increase/decrease the row height in the output display ?
    How ?

    kps204020 wrote:
    Thanks a lot for your response.
    I've tried your proposal, but it has no affect. The report cells show all their content using as much lines as necessary for this.This is the default behaviour for HTML table data (tables and cells expand to fit their content).
    So I still have rows with lots of lines and rows with only a few lines mixed in my IR dependant on the cell content. Because some rows filling nearly the whole screen, it is difficult to get an overview with regard to adjacent rows.
    I'm using Application Express 4.1.1.00.23. with Theme 21. Scarlet and Firefox 17.0.1.Are all users using Firefox?
    Actually I'm working on my first APEX Solution for usage in my company and the customers demanding a solution for this topic . So I'm very keen to find a solution.
    I'm very much looking forward to your response.I've been involved with similar issues in the past. My first response is simple: Does this data have to be shown in the report? Can the offending column(s) be removed from the primary report? They will still be visible in the single row view, and the detail view if there is one.
    The second option is to create a detail view for the report with a structure that is better suited to the data involved, and make this the default view. (For an example of this, see the treatment of the PRODUCT_DESCRIPTION column in the detail view of the Products report in the Sample Database Application: click on the View Detail button on the Products page.)
    The third possibility is some kind of customization of the presentation of the data. This will involve using some combination of HTML/CSS/Dynamic Actions/Plug-ins/JavaScript that you may not be familiar with: do you have experience of these? To go down that route you need to describe in detail how you want to present the data, or what behaviour is required when the data is too long, and share an example of the report on apex.oracle.com that we can work with.

  • JTable and adjusting Row height

    Hi,
    How to make a row height adjustable, like user can click on the row and drap to increase the height of the row,
    Also if i have JTextArea as cell rendere how do i dynamically adjust the row height to display all the text
    Ashish

    That's a lot of questions..... but here are your answers:
    1. Can we adjust variable row height for each row,Yes, use JTable's setRowHeight method to set the height of each row.
    2. Also as we adjust the column widht, can we adjust the row height by dragging,You should be able to adjust the column width by clicking the mouse on the edge of the column header and drag. There is no automatic provision for changing the row height that way -- you'll have to add a mouse listener to the rowheader and write your own code to perform the resizing.
    3.Suppose i have JTextArea as a cell renderer , how can i display all the text in a row with out having to use a scroll bar, You'll have to figure out how many rows (based on the sum of the individual row's height) the textarea occupies (taking into consideration the font that you used to render the textarea). I have my own way of doing things but if you search this forum, you'll find a lot of discussion on how to do it.
    ;o)
    V.V.

  • Problems with Automatic Adjust row height in FRs ver. 11.1.2.1.103

    Hi
    We have just upgraded to 11.1.2.1.103 from 9.3.3.
    .103
    We had a fairly complex report that worked in the previous environment, but not anymore.
    We have a number of text lines with that pulls from other lines in the report that are hidden.
    It is celltext that we are reporting on.
    The lines are setup, so the row height should just adjust depending on the amount of text, but it does no longer work for consecutive lines with the adjust row hight atribute swithed on. I now have to insert blank text lines with a fixed height in between to get it to work.
    It makes the report the report look messy, so has anyone had similar issues and know a work around or a possible patch.
    KR
    Per

    Okay,
    I tried that I when I tried to use: sqlplus -s I got the following results
    SQL> sqlplus -s
    SP2-0042: unknown command "sqlplus -s" - rest of line ignored.
    I am also still getting the following in my output:
    Any other suggestions?
    SQL> Select
    2 'Siebel CVP' as Source_Name,
    3 'RCI' AS Brand,
    4 'Phone' AS Channel,
    5 'Inquiry' AS EBR_Type
    6 FROM dual;
    Siebel CVP RCI Phone Inquiry
    SQL> set head on
    SQL> Select
    2 substr(con_home_ph_num,1,10) AS Chan_Addr,
    3 'No EBR Date' As EBR_date,
    4 substr(x_rccl_brand,1,3) AS Brand,
    5 'Phone' AS Channel,
    6 substr(con_person_uid,1,21) AS Src_Id,
    7 substr(x_rccl_source,1,23) AS EBR_source,
    8 'Inquiry' AS EBR_Type
    9 FROM
    10 siebel.eim_contact
    11 WHERE
    12 con_home_ph_num is not null and
    13 con_home_ph_num > '201'
    14 and length (con_home_ph_num) = '10'
    15 and con_home_ph_num <> '0'
    16 and con_home_ph_num <> '1111111111'
    17 and con_home_ph_num <> '9999999999'
    18 and con_home_ph_num <> '0000000000'
    19 and con_home_ph_num NOT LIKE '+%'
    20 and con_home_ph_num NOT LIKE '0%'
    21 and con_home_ph_num NOT LIKE '123%'
    22 and con_home_ph_num <> '2222222222'
    23 and x_rccl_call_type is null
    24 and x_rccl_brand = 'RCI'
    25 and TO_DATE(TO_CHAR(x_rccl_entry_date, 'MM/DD/YYYY'), 'MM/DD/YYYY') >= TO_DATE(TO_CHAR(sysdate, 'MM/DD/YYYY'), 'MM/DD/YYYY')
    26 and x_rccl_source IN ('CTI','CTI_GVS','CTI_HOTWEB','CTI_PRE_SHOPPING_CALL','DIR_PASTGUEST_RECONNECT')
    27 ORDER BY
    28 con_home_ph_num asc
    29 /
    CHAN_ADDR EBR_DATE BRA CHANN SRC_ID EBR_SOURCE
    EBR_TYP
    5167350937 No EBR Date RCI Phone Prospect - 1-3IIJ-218 CTI_PRE_SHOPPING_CALL
    Inquiry
    8054977010 No EBR Date RCI Phone Prospect - 4861358 CTI_PRE_SHOPPING_CALL
    Inquiry
    SQL> spool off

  • Set row height in JTable

    i would like to hide, show row/s in the JTable. I try it with setRowHeight but it affect all rows.
    is it possible to do it ? what shoud i rewrite(add) to create this functionality?
    i use JDK1.2.2 :-(
    thanks Tomas

    The other way is to modify your table model class:
    Let the getValueAt method return only the rows you need and the getRowsCount method return the needed row count.
    It may be done in respect to some condition of the table
    Best regards,
    Martin

  • Row Height Frozen/Can't Be Adjusted

    I transferred data from a web table into Numbers. When adjusting row height using Inspector, the height changes, but the text is partially hidden (rows 18-22 in image). When double-clicking the number of the row, the row automatically adjusts to its original height (rows 16 & 17 in image).
    Any ideas what is preventing row height from being modified?

    Hi TIm,
    You might also check in the format menu> Text >Layout > Text inset.
    quinn

  • CS2 automatically fit row height to content in table?

    Hi guys, I'm using CS2 and I have a table with lots of pages. I need to be able to have the height automatically fit to the content of the tables. Unfortunately data is not consistent therefore some cells have 2 rows of content, others 8.
    Automatically fit to content is not available.
    I have tried adjusting row heights then 'table' > 'distribute rows evenly' but obviously this is no good as some are too cluttered, others too spacious.
    Any suggestions appreciated.

    Huh. Maybe I read the OP's posts correctly, I think, but I misread yours. I assumed that, since the thread-opener mentioned row height, that when the OP asked about getting rid of "distribute evenly" that row height was still under discussion. Looks to me like all you can do with cell width/column width is
    1) Select a column and specify an exact width
    2) Select a group of columns and specify the same exact width for all of 'em
    3) Select all the columns and
        a) Distribute columns evenly
        b) Specify an exact width for all columns
    Unfortunately, I have to use tables a great deal, so I feel like I'm up to speed on what we can and cannot do with ID tables.

  • ALV grid Row Height

    Is it possible to adjust row height of alv output?  I have a grid being displayed on a touch screen and it's difficult to choose a row.  I want to make them about double the height on display.

    Hello Michelle
    There is no possibility to change the row height. The only possible way I see would be to reduce the <b>resolution </b>of the touch screen.
    Regards
      Uwe

  • JTable and Adjusrt Row Height

    Hi,
    1. Can we adjust variable row height for each row,
    2. Also as we adjust the column widht, can we adjust the row height by dragging,
    3.Suppose i have JTextArea as a cell renderer , how can i display all the text in a row with out having to use a scroll bar,
    Ashish

    That's a lot of questions..... but here are your answers:
    1. Can we adjust variable row height for each row,Yes, use JTable's setRowHeight method to set the height of each row.
    2. Also as we adjust the column widht, can we adjust the row height by dragging,You should be able to adjust the column width by clicking the mouse on the edge of the column header and drag. There is no automatic provision for changing the row height that way -- you'll have to add a mouse listener to the rowheader and write your own code to perform the resizing.
    3.Suppose i have JTextArea as a cell renderer , how can i display all the text in a row with out having to use a scroll bar, You'll have to figure out how many rows (based on the sum of the individual row's height) the textarea occupies (taking into consideration the font that you used to render the textarea). I have my own way of doing things but if you search this forum, you'll find a lot of discussion on how to do it.
    ;o)
    V.V.

  • Dynamically adjust table row height based on data in column

    Hi all,
    I'm using JDeveloper 11.1.1.5.0 and have a requirement for a table to adjust the height of its rows depending on the data in the columns. One of the columns in the table is a rich text description field and I have the 'rows' property set to 13. This field could have twenty lines of text/images or just one. The users would like the page to show all twenty lines of text without having to scroll but the table has the same height for all the rows (that I set to 13) and provides a scroll bar when the data exceeds this size. My users do not like to scroll, and want the height of each row to be determined by the data in it. I looked at a few options and also did a search online, but was unable to find anything to fulfill this requirement. Do you know of how I could change the height of each row in the table so that it fits the data that it holds?
    I have an example of my table at: <b>Table with Set Row Height</b>
    As you see, the picture has to be scrolled so that the whole picture is visible. The user requirement is to adjust the row height to show the full picture. Ideally the next two rows would shrink, but that would be a nice to have.
    Thanks in advance for any pointers or help.

    Hi Frank,
    Thank you for replying to my question, I truly appreciate your help.
    I tried to use the autoHeightRows to adjust the height of my rows but was unsuccessful. If I understand the autoHeightRows property correctly, this is used for setting the height of the whole table. If this is incorrect and it can be used for setting the height of individual rows in the table, please correct me. I have the 'Rows' property of the richTextEditor set to 13 and this is the height that I would like to make dynamic based on the data.
    My users requirement is for the height to be big enough for the data in each row of the table (the table has a description column and the height of each row should be determined by the data contained in it). I updated my <u><b>Screen Shot</b></u> to show the desired layout and what is currently being generated though ADF (http://www.flickr.com/photos/87583386@N05/) .
    I have three rows in the example (in actuality these are around 50) and the text in each row can vary. The users would like to see the full text/image in each row without having to scroll each row. Currently my table is within Panel Box, which is inside a PanelGroupLayout-Scroll which is in a PanelStretchLayout. I tried to put the table by itself with the autoHeightRow modifications you suggested but thsi did not help either. I am using JDeveloper 11.1.1.6.
    Is this possible with an ADF Table? If it is, is the autoHeight property the only one that I am setting incorrectly? If not, is there another component I can use to get the desired functionality? My users are very strict about this requirement and will not accept the application without this.
    Thanks,

  • How to bind JTable row height to the maximum height of a the columns

    Suppose i have a JTable. data setup is done. Thing is whenever data font size increases table row height should change. How?

    Add a PropertyChangeListener to the table to listen for a font change event. Then use the setRowHeight() method of the table.

  • How to set the row height in a JTable

    Is there a way to set the height of a row (actually all rows) in a JTable?
    I have tried setting the font to be bigger but then the cells are not big enough.

    Use "rowHeight" method of JTable class.
    For more information about JTable class, please read the API documentation at http://java.sun.com/j2se/1.3/docs/api/javax/swing/JTable.html
    /Sreenivasa Kumar Majji.
    Is there a way to set the height of a row (actually
    all rows) in a JTable?
    I have tried setting the font to be bigger but then
    the cells are not big enough.

  • TableLayoutPanel row height adjustment for dynamic row

    Dear all, 
    i use a tablelayoutpanel to populate a calendar display. 
    As the row are generated dynamically during run time. 
    I would like to know how do i adjust the height in runtime for those row generated during runtime
    I notice after the table populated, the row count always to return one

    example :
    For i = 0 To table.Rows.Count - 1
    table.RowStyles.Add(New RowStyle(SizeType.Absolute, 100))
    Next
    This would set a 100 px height for each row.
    Nimzozo, from France.

  • Dinamic JTable Rows Height

    Hi!
    Is it possible to change dinamically and automatically JTable row height depending on a cell content to display it correctlly wraping the text?
    In some of my cells content is too long and It's difficult to display it properly ...
    Thanks!

    This link might help:
    http://www.javaspecialists.co.za/archive/GUI.html

  • Conditional Text in Table - Problems with row height adjustment

    Hey there,
    I’m german but I try to express my problem in english as good as I can. Not always easy with the different menu names. Hope you get what I want to say! :-)
    As you can see in my attached screenshot, I placed text in a table.
    Text height is set to: minimum 1,5 … so it adjusts to the amount of text.
    This is what I want - it should adjust the height to the marked/aktivated conditional text.
    It always adjusts the hight when I blind out the first line oder lines in between (e.g. line 2+3 of 4).
    But if I want to blind out the last line(s), there is a ¶ at the end and a extra blank line with the #.
    I know, the # stands for the following hidden Text, but why does it work with the red/green text.
    There is also text hidden (green), but the mark # is right after the last word - not in a new line.
    Has anyone a solution for this?
    Thanks in advance!

    That's ok so far. A paragraph sign at the end of a text forces a new line.
    To change that do the following:
    For every condition you need another condition just for the paragraph sign that comes immediately after the condition. Not after every paragraph of one condition, but at the end of every consecutive numbers of paragraphs of the same condition.
    So in your third example you'll need two conditions more:
    1. One for the paragraph sign at the end of condition "meaasurements"
    2. One for the paragraph sign at the end of condition "price 2"
    Whenever you make the other conditions invisible, you also have to turn off the new conditions that only control the paragraph signs.
    See the following screenshots:
    Uwe

Maybe you are looking for