JTable.setRowHeight(int row, int rowHeight) sets the row height to Zero

TableModel1 model1 = new TableModel1();
TableModel2 model2 = new TableModel2().
JTable table = new JTable();
I dynamically switch the model of the table by calling table.setModel(model1) or table.setModel(model2).
Now, I have to show rows of variable heights in my table. But when I say table.setRowHeight(row, rowHeight), it is setting it the rowHeight to Zero. What is the problem? Does the fact that I am changing the tablemodels is causing any problem?
Any help is really appreciated.
Thanks in advance!

OK, I found two fixes to this problem:
1. upgrade to jdk1.4
OR
2. When table model data is changed, replace the calls to fireTableDataChanged() with appropriate combination of calls to fireTableRowsDeleted(), fireTableRowsInserted(), and fireTableRowsUpdated().
I'm not sure if #2 will work for you since you're changing the table model entirely, but you might try #1. I got the ideas from bug 4398268. Good luck!

Similar Messages

  • Is it possible to set the cell height in a cell style?

    In the attached screenshot, the cell height is set to exactly 0.125. I put my cursor in the cell, then opened the cell styles panel and created a new cell style based on this cell. But when I apply the cell style to other cells, it does not apply the cell height. There were no overrides or other styles applied to the other cells. I also opened up the cell style definition from the cell styles panel, but don't see anywhere to set the cell height there either. Is there another way to do this that I am missing?

    It is possible - and it's fairly simple.
    To set the row height as part of the cell style, all you have to do is use the cell inset above and below. As long as you set the style as 'At least' then this works perfectly well for having predefined cell styles.
    I have been using this successfully for large financial documents for some time without any hitches. For example I use it to get separation between sections within the tables by having a style with extra space above, and similarly for totals rows at the bottom of the table. It can of course also apply different stroke styles at the same time. Having the style set as 'At Least' also allows for multiple line entries to still have the correct spacing above and below.
    So if you spend a bit of time calculating required heights and setting up your styles, then apply a keyboard shortcut to each style, you can then save a whole lot of time when formatting the document.
    I've just finished nearly 400 pages of financials using this method over the past couple of days!
    This solution may not suit your sitation, but if you have a lot of tables to get through it's got to be worth giving it a try.

  • 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.

  • 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.

  • Re: How to set the line height of a Label?

    In Java 8, set the graphic of the label to a TextFlow with line spacing set.
    Text text = new Text("This is my\nspaced text.");
    TextFlow flow = new TextFlow(text);
    flow.setLineSpacing(13); // default font size is 13px, so this effectively makes the text double spaced, e.g. one line of text, one blank line, another line of text, another blank line, etc.
    Label label = new Label();
    label.setGraphic(flow);
    For Java 7, I don't know how you would set line spacing for a label.

    In Java 8 you can do it even more simply:
    Label label = new Label("This is my\nspaced text");
    label.setLineSpacing(13);
    The line spacing property can also be set with css:
    .label {
    -fx-line-spacing: 13;
    Of course, none of that actually helps to do this in Java 7. If you're not wrapping the text, you can fairly easily split the text at new lines, and add a label for each line to a VBox, specifying the spacing for the VBox as required.
    If you're wrapping text, trying something similar gets ugly rather quickly.

  • I can't set the minimum height for a flowed subform

    I have a subform, sfQ, that holds four items, tfInitials, cbQ, tfTypeCheck (hidden), and tfQ1. tfQ1 is a text field that allows multiple lines. All four start with a height of .3125in. When I set the subform to flowed, the items move to "top to bottom" order, and the subform changes height to .9375 (as I would expect). When I change the subform back to "Western text", the subform's height does not shrink back to .3125in. I would expect it to shrink back down since the subform does not need to be so large when the lines are running left-to-right.
    If I select the subform and go to the layout pallette, then type in the height I want, it reverts back to .9375in.
    If I click and drag the sizing box in the design view, it expands back to it's larger size.
    If I remove all but one field and change the subform to flowed, it still goes back to .9375!
    If I go to the docReady event for the subform and set the height with this.h = ".3125in"; the subform will not expand when the text field tfQ1 receives a long value (two or more lines).
    Any ideas about getting around this?

    I figured it out...
    I added another line to the docReady event, so now I have:
    this.h = ".3125in";
    this.maxH = "9in";

  • How to set the variable height for TileLayout

    Hi,
    I am using TileLayout in  <s:List> component . TileLayout takes the maximum height of the children and draw the same height for rest of the children in all rows. Instead, I want to have all the rows with various heights if their children have different heights.
    I know there is variable height property in <mx:List> component but which is not there in its spark counterpart. Can you please help me with this issue??
    Thanks,
    Bhoja

    The spark TileLayout class lays out all of its elements in equally sized "cells".  Cells of variable sizes is not currently supported.

  • Is there a way to set the printed margins to zero. I want to fill the whole page, as much as the printer allows.

    Normally Firefox prints Title, URL, time and page number on the four corners of the printed page. I want to remove printing of this
    information and instead print the page out to the corners limited by
    what the printer allows. I know how to stop printing the URL etc. but then I get empty margins. I want to set this margins to zero so Firefox prints on the whole paper sheet. As it is now I will have to use another browser that doesn't insert unwonted margins.

    Is there a way to set the FOLDERS window in Adobe Bridge as a Column view like in Mac OSX Finder?
    No, but it is very nice idea, add it to the feature request page:
    http://feedback.photoshop.com/photoshop_family/

  • Setting the rectangle height at RUNTIME

    Hi. I am looking for a way to set a rectangle's height at runtime. Basically, I want to do a column-type chart, but by code. If have looked into the SRW package, but couldn't find any property related to that kind of item. If you know of any other way, even without using a rectangle, of doing this, please share.
    Thank you!

    Hi, thank you for taking the time to answer my question.
    not quite sure what you are trying to do .. it almost
    sounds like you wanted to draw a graph using reports
    objects. why are you not using our graphing solution
    ? The reason I want to avoid using Graphics is because:
    (1) The graph is a simple graphic and I think it would be too much waste if I use graphics.
    (2) I want to avoid the run of a second runtime (in this case, Graphics runtime).
    to answer your question .. there is no way in reports
    to programmatically change the width and/or height of
    objects. they are determined by the content of the
    object (e.g. a field).Yes, but there is no way to have a source on a rectangle, right ? Want I am thinking now is to instead of using a rectangle, use a field and make it grow vertically, so I can manage by its source. What do you think about it ?

  • Can the next version please allow for the line height to be zero in a text box? I can only go down to .01?

    I want to create a flipping calendar. I had this brilliant idea of putting each date 01 02 03, etc in one text box, with a hard return in between, and then set the line height to zero. Then set the type to appear one paragraph at a time. It would eliminate 20 animation steps. It worked beautifully except that I can't get the line height to set to zero. It will only go to .01. Bleh!
    So please, Can the next version allow for the line height to be zero in a text box?
    Also, separate timelines would be nice instead of one long string so it would be easier to have more than one animation happening at once.
    Just a thought.
    PS - I also noticed it would be nice to have the option of having the first line in a text box dissappear or dissolve or flip out before the next one comes in, rather than just each building in on top of each other.

    In these forums you are just talking to users, not developers. To provide your feedback, in Keynote go to Keynote Menu>Provide Keynote Feedback and send your request that way.

  • How to set the row height for a list control in flex 4.5 for mobile?

    Hi,
      I have a List in my Adobe Flash Builder 4.5 and flex 4.5 mobile application. I show the image and the label in my list. The list item height gets adjusted based on the image height. I don't want this auto row adjustment. Instead I would like to set the row height manually.
    Is there any property to set the item height in a list?

    setting rowHeight in the List layout works for me.
    <s:List>
    <s:layout>
    <s:VerticalLayout rowHeight="48"/>
    </s:layout>
    </s:List>

  • How do you set the y-intercept to 0 for a trendline? HELP PLEASE!!

    So I created my xy scatter plot and have the trendline and I need to know how to set the y-intercept as zero to get the slope to be the average solution of my equation but I don't know how to do this. Help PlEASE!

    If you want the slope with the Y intercept forced to zero, use the LINEST function. It has a parameter that allows you to force the Y intercept to zero. If you want this trendline to be on your chart, you will have to create a couple of X-Y pairs using the slope then plot them as another data set on your chart rather than using the built-in trendline.

  • Set the dialog modal window width + height

    hi ,
    i tried to set the width+ height using
    window.dialogWidth , innerWidth , Width that come from a java code
    but without success.
    only the dialogWidth seemed to change somthing but it wasn't
    to the size that i passed , for value of 400 for example it changed
    the width to almost all the screen.
    Please advise .

    Are you still asking JavaScript questions here?
    Java != JavaScript
    Please take your JavaScript questions to a JavaScript forum.
    If this is not a JavaScript question then please post the relevent formatted code.

  • Determine the type of connection & set webcam width/height

    Hi, two quick questions:
    1. Is there a way in ActionScript to determine what type of connection is being used (e.g. P2P or FMS)?
    2. Is there a way to set the width/height of the webcam picture? I currently extend the WebcamPublisher class to access the _camera instance and use the Camera.setMode() method, but it looks like that doesn't have any effect whatsoever.
    Thanks in advance,
    Michiel
    PS: I'm aware of the captureWidthHeightFactor method, but I really don't like that approach, as it's not really clear what dimensions are being used for the video. I would like to set the dimensions myself, like when using the Camera.setMode() method.

    Hironmay wrote:
    For you height/width part, you can use resolutionFactor API in webcamPublisher as captureWidthHeight API is deprecated. The default width and height gets multiplied.
    Ok, I'm using resolutionFactor now, but I'm not sure what the difference is. captureWidthHeightFactor is not really documented (it's there, but pretty unexplained), but the resolutionFactor uses multiples of the default width/height. I assume it does the exact same thing? (By the way: the resolutionFactor is not documenten on livedocs, only in the local documentation received as part of the zipped SDK.)
    And still if you want to set your own native width/height , since you are already subclassing WebcamPublisher, just subclass the function createMyStream and add your native width and height. See that function in the player 9 source code of WebcamPublisher provided.
    I'll look into that, for now resolutionFactor will have to do. (For testing purposes all video parameters have to be adjustable on the fly, and I unfortunately am already very short on time.)
    One thing I forgot to mention in last mail, you can only have P2P with player 10 and you need to use player 10 swc for any verification of P2P. Player 9 will be always FMS.
    You may have just saved my life! I was indeed using the player 9 swc, and tried the isP2P property, but didn't get it to work. And since it's not documented I labeled this as "deprecated" and dropped it. Great to see that it really is in there.
    Also, the difference between the player 9 and player 10 swc you just explained answers another question I had (but totally forgot about). When connecting, the console always showed:
    #FMSConnector# Wed Jan 6 10:52:11 GMT+0100 2010 is using RTMPS? true
    This gave me the idea that the P2P service was unavailable. I'm glad to see that this isn't the case.
    Thanks for your rapid replies everyone, I really appreciate it!
    Michiel

  • Please help me :How to set the width and height for my View page "test.htm"

    Hi,
        I have controller class. When i call the view[test.htm]from this controller class ,i am getting the view with output tableview..it is fine.
    My requirement:
                 the output view window is showing full browser window. I want the view output like showModeldialog. I want to set the width and height for the output view window. How is possible?
                 or
    i want to call the test.view in the window.showModelDialog..
    Please help me .. Urgent requirement.

    Yes you can set the width & Height of the view as follows..
    <div style="width:580px; height:750px; margin-top:15px; overflow:auto;">
    <htmb:form......>
    </htmlb:form>
    </div>
    <i>*Reward each useful answer</i>
    Raja T

Maybe you are looking for