SetRowHeight(int row,int height) fails

Hi!
I have a problem when I want to resize a row to a new height using the method
setRowHeight(int row,int height)this don't do nothing!
I'm using the example of a special JTable to merge cells wich is avaiable in http://codeguru.earthweb.com/java/articles/139.shtml
I try to look in the code of this example, but I can't find the problem.
I'm not using the merge method in the row I want to resize, so it should be working.
If someone could help me I appreciate.
Thanks in advance.

From what I can tell from looking at the source code for MultiSpanCellTableUI, the paint method draws the cell rects using the general row height (ie table.getRowHeight() ) instead of the row specific height (table.getRowHeight(int row)). This could be a design flaw. You could attempt making the change in source code and see what results you get.
ICE

Similar Messages

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

  • IEssGridView.getData.getDataCellAttributes(int row, int column)  returns 0

    I am retrieving cells containing values. In trying to figure out whether the cell is a READ_WRITE or a READ_ONLY cell, I called the getDataCellAttributes method for the cells in question. They all return zero attribute values.I printed out the values of DATA_CELL_ATTRIB_READ_WRITE (2) and DATA_CELL_ATTRIB_READ_ONLY (1). Presumably a non-zero value should be returned by this call. What am I doing wrong?Nils

    Try this:IEssDataCell dataCell = (EssDataCell)grid.getCell(i,j);if (dataCell.getAccessMode()==IEssDataCell.EEssAccessMode.READ_WRITE) {..} else {..}

  • How to set different bgcolors for rows int HtmlDatatable?

    I have JSF HtmlDataTable on my page. I need to fill rows in table by different colors, according to row's data, but I can't find any method for it...... Should I use JavaScript in this case?

    Due to your words, I tried it myself once. And it just works?
    Here is the dummy example:
    JSF<h:form>
        <h:dataTable binding="#{myBean.table}" value="#{myBean.list}" var="item"
            rows="5" rowClasses="#{myBean.rowClasses}">
            <h:column>
                <h:outputText value="#{item.name}" />
            </h:column>
            <h:column>
                <h:outputText value="#{item.value}" />
            </h:column>
            <f:facet name="footer">
                <h:panelGroup>
                    <h:commandButton value="first" action="#{myBean.pageFirst}"
                        disabled="#{myBean.table.first == 0}" />
                    <h:commandButton value="prev" action="#{myBean.pagePrevious}"
                        disabled="#{myBean.table.first == 0}" />
                    <h:commandButton value="next" action="#{myBean.pageNext}"
                        disabled="#{myBean.table.first + myBean.table.rows >= myBean.table.rowCount}" />
                    <h:commandButton value="last" action="#{myBean.pageLast}"
                        disabled="#{myBean.table.first + myBean.table.rows >= myBean.table.rowCount}" />
                </h:panelGroup>
            </f:facet>
        </h:dataTable>
    </h:form>MyBeanpackage mypackage;
    import java.util.Iterator;
    import java.util.List;
    import javax.faces.component.html.HtmlDataTable;
    public class MyBean {
        // Init ---------------------------------------------------------------------------------------
        private HtmlDataTable table;
        private List<MyData> list;
            loadList();
        // Actions ------------------------------------------------------------------------------------
        private void loadList() {
            list = new ArrayList<MyData>();
            int i = 0;
            while (i++ < 20) {
                list.add(new MyData("name" + i, i * 10));
        public void pageFirst() {
            table.setFirst(0);
        public void pagePrevious() {
            table.setFirst(table.getFirst() - table.getRows());
        public void pageNext() {
            table.setFirst(table.getFirst() + table.getRows());
        public void pageLast() {
            int count = table.getRowCount();
            int rows = table.getRows();
            table.setFirst(count - ((count % rows != 0) ? count % rows : rows));
        // Getters + setters --------------------------------------------------------------------------
        public HtmlDataTable getTable() {
            return table;
        public List<MyData> getList() {
            return list;
        public String getRowClasses() {
            StringBuilder rowClasses = new StringBuilder();
            List<MyData> subList = list.subList(table.getFirst(), table.getFirst() + table.getRows());
            for (Iterator<MyData> iter = subList.iterator(); iter.hasNext();) {
                rowClasses.append(iter.next().getName());
                if (iter.hasNext()) {
                    rowClasses.append(",");
            return rowClasses.toString();
        public void setTable(HtmlDataTable table) {
            this.table = table;
    }MyDataprivate String name; // + getter + setter
    private Integer value; // + getter + setter
    public MyData(String name, int value) {
        this.name = name;
        this.value = new Integer(value);
    // + no-arg constructorIn the generated source I see in every page the same <tr class=""> value as the MyData#getName().

  • Puzzel- Method to optimize int[ ][ ]of int[ ][ ]'s

    I'm righting a class that takes an int[][], initially filled with 0 or null. A rectangular block is added to the int[][] with a value of 1 - 9. Another rectangular block is added to the int[][] with a different value from the first, usually the next int (2). The current setting is
    final static int width = 47;
    final static int height = 3800;
    public int[][] grid = new int[47][3800];
    I have a method addBlock(int blockWidth, int blockHeight) which adds a block to the grid. However it doesn't properly optimize the grid to fit the most efficient number of blocks. It simply adds a block to the top left corner of the grid (where the top left is grid[0][0]) and checks to make sure the next block does not overflow the width bound of 47. If it does it simply places the block at the first available grid where the grid value = 0 and does not overflow the bounds. It doesn't check to make sure that it isn't overriding other blocks, and it doesn't move existing block to make room for new blocks.
    What I am looking for is a way to keep individual blocks together. There could come a situation where two blocks with the same value touch. In this case what would happen?
    Also how do you move blocks once they have been added to the grid?
    Finally, is there an existing algarythm for doing a best fit on a grid of grids?
    Suggestions, other places to look, code, websites to check or any valuable information would be greatly appreciated.
    If needed I could post the existing source, which stacks the grids from the upper left corner and works down. I have a viewer written already which reads in an int[][] and displays it in 9 colors, however I can easily expand the color recognition to as many colors as needed.

    Hi again,
    even if the sequential adding of block will not lead to an optimized layout of the templates on the bolt, we can improve the algorithm given by robert19791 - starting from the top left position of the bolt working towards the right bottom we can say the following:
    The top-left corner of each rectangle is on the right or bottom edge of another rectangle except for the first one added. So, when we search for a position, we will do it along these edges of all the rectangles added before. The test, if it fits in a certain position, can be done with an intersection check with all other already added rectangles, which right or bottom edges are not left or top of the tested position. Ofcourse the rectangle to add must be inside the bolt.
    This will reduce the postions to check and also give a solution for the overlapping problem Robert has mentioned. In those cases where the fit test fails, it should be tested, how large the overlapping area is - if it is not so big, it is perhaps a good idea to shift the rectangle, which would be overlapped otherwise. During such a shift operation the rule of the top-left-corner sitting on the right or bottom edge of another rectangle can be broken, instead the rule is, that an edge is in contact with another rectangle's edge.
    Ok, this for now
    greetings Marsian

  • From int[][] to int[]?

    I have a double array: int[][] of a variable length.
    Now I would like to store each row of this double array in a single array, is that possible considering that it needs to work on a variable array length?
    I have tried:
    int[][] test = new int[s][s];
    int[] row = new int[s];
    for (int i = 0; i < s; i++){
         for (int j = 0; j < s; j++){
               row[j] = test[i][j];
         }But I need to create a new array each time the second for loop terminates..which I can't figure out to do.

    As "row" is declared, you will overwrite the value every time the second loop terminates. I really don't understand what are you trying to do, maybe store "test" in a simple array?
    Then try this:
    int[][] test = new int[s][s];
    int[] row = new int[s*s];
    for (int i = 0; i < s; i++){
    for (int j = 0; j < s; j++){
    row[j+i*s] = test[i][j];
    Was it?

  • My Firefox crashes every time I open it and none of the steps in the database solve the problem. My crash signature is PaintFrame(nsIRenderingContext*, nsIFrame*, nsRegion const&, unsigned int, unsigned int)

    I tried opening it in safe mode and none of the other help tips in the database on firefox crashes when I open it apply to me. I also ran a couple of virus programs to check for any infections and found nothing. I had been having issues with java previous to firefox beginning to crash. So I attempted to uninstall java from my computer but it did not help.
    My crash signature is PaintFrame(nsIRenderingContext*, nsIFrame*, nsRegion const&, unsigned int, unsigned int) and a search of this term on Mozilla Support pulled up no results.
    I'm not terribly knowledgeable with programming so any suggestions would help!

    I read online about a "clean reinstall" of firefox which seems to have worked! They should include direction on this on their page: https://support.mozilla.com/en-US/kb/Firefox+crashes+when+you+open+it

  • StringBuffer delete (int start, int end) is too slow - HELP!!

    I've traced a performance problem to one line of code: a StringBuffer "delete (int start, int end)" call.
    My StringBuffer contains a lot of data, maybe 500,000 characters. My code loops, searching for a particular character (the search is fast, btw). When that particular character is found, I want to delete that character plus the characters following it. My code looks something like:
    int pos;
    while ((pos = myStringBuffer.toString().indexOf('~')) != -1)
         myStringBuffer.delete(pos, pos + 3);I'm 100% sure the bottleneck is the delete call. If I change the code to the following, where I've commented out the delete, it loops the same number of times and runs lightning-fast:
    int pos = 0;
    while ((pos = myStringBuffer.toString().indexOf('~', pos)) != -1)
         pos++;The loop, and therefore the delete method, will be executed thousands of times. To give you some idea of the poor performance I'm seeing, the first code (with the delete) takes more than 10 minutes to run, while the second code (without the delete) takes less than one-tenth of one second.
    Any suggestions? Thank you.

    Thanks for all the help! da.futt's solution works perfectly: 65,000 times through the loop in about one-tenth of one second. Problem solved.
    We're still on Java 1.3.1 (large company = slow to upgrade), so I can't even remove toString(). I wonder how many "small" performance problems we have (and are unaware of) that could be addressed by upgrading?
    My first posting here and a positive result. I'm not a Java expert, but neither am I a rookie. I'll be back to try and help others as I've been helped here.
    Thanks again.

  • How to get the row that has failed due unique constriant voilation

    Does any body knows how I can get the column values for rows that has failed on unique contriant voilation, I am using 10gr2.
    Also we don't have license for shadow table error logging, otherwise I could have gotten the row from there.
    Any help will be highly appreciated.
    Thanks,
    Ravi

    Hi Ravi,
    Prior to OWB 10.2.0.3 you can use the DML error logging features only for the mappings which runs
    in ROW based mode.
    But from OWB 10.2.0.3 onwards DML error logging features can be used for SET based mappings also.
    You can refer the following Metalink notes for the same
    1. Note 550036.1 DML Error Logging In OWB 10.2.0.3 And OWB 11g
    2. Note 549845.1 How To Use Data Rules And Error Tables Features In OWB10gR2
    Thanks,
    Sutirtha

  • Memory leak in String(byte[] bytes, int offset, int length)

    Has anyone run into memory leak problem using this String(byte[] bytes, int offset, int length) class? I am using it to convert byte array to string, and I am showing memory leak using this class. Any idea what is going on?

    Hi,
    If you post in Native methods forum I assume you are using this constructor in the native side.
    Be aware that getting char * from jstring eats memory that you must free before returning from native with env->ReleaseStringUTFChars().
    --Marc (http://jnative.sf.net)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Question about public void characters(char []ch, int start, int length) thr

    Can anyone tell me how you would keep all the characters from within one pair of tags together each time characters() is called?
    the character() method doesn't read all the character data at once, and i would like to create a buffer of what it has read.
    thank you.

    I recommend using getNodeName and/or/combination
    with
    getNodeValue to get the strings.i have tried using a buffer, and i have got that to work!
    At long last I am seeing the string I would like to see as it is in the xml file!
    thank you for your help
    here is an example of my code:
    private boolean isDescription = false;
    StringBuffer sb = new StringBuffer();
    public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
         if(localName.equals("description")) {
              sb = new StringBuffer();
              isDescription = true;
    public void characters(char []ch, int start, int length) throws SAXException {
         if(isDescription == true) {
              String desc = new String(ch, start, length);
              sb.append(desc);
    public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
         if(localName.equals("description")) {
              isDescription == false;
              System.out.println(sb.toString());
    }

  • How to user bufferedreader.read(char[] cbuf,int off,int len)

    how to user bufferedreader.read(char[] cbuf,int off,int len)?
    can you give me an sample code? i dont understand the use of offset here... thanks!

    The offset simply gives you the ability to read in data starting at some point in the buffer other than the first character.
    If, for example, you are reading from some stream that is being filled slower than you are reading, then you can write a read loop that will fill the buffer with successive reads - the first at character 0, then next offset past the end of the first set of data, etc.

  • Export to Excel: Row Auto Height Removed on Data Connection Refresh

    Hi all,
    When I perform a Data Connection Refresh on an Excel workbook exported from SharePoint it removes the row auto height I had in place, hiding valuable information. This is an additional column I added to perform some calculations.
    Any ideas?
    K.
    Personal Blog: http://thebitsthatbyte.com

    Hi Kelly,
    As I understand, you have a SharePoint list and click export to Excel under List tab. Then the list is exported to Excel spreadsheet.
    Generally speaking, all field column width and height keep in the same size when the list is exported to Excel. In Excel, under PAGE LAYOUT tab > Scale to Fit, make Width and Height to be Automatic and Scale to 100%.
    Then the cell should be good. If there is some column still exceed the width of Excel cell, please right click the cell > Format cells > Alignment > Text control, click Wrap text to increase the cell size to fit the text, or click Shrink to fit
    to shrink the text.
    Regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected] .
    Rebecca Tu
    TechNet Community Support

  • Can't convert int to int[]    URGENT!

    HI list!
    Here is the code part I have:
    /** Holds the permutated groups which are arrays of integers. */
    Vector v;
    if(arg.length<3) System.exit (0); //Need at least 3 arguments
    elements=new int[arg.length-1]; //Create array to hold elements
    /* Copy the arguments into the element array. */
    for(i=0;i<arg.length-1;i++) elements=Integer.parseInt(arg[i+1]);
    groupsize=Integer.parseInt(arg[0]); //Get the number in each group.
    calc(groupsize,elements.length); //Find out how many permutations there are.
    v=permutate(groupsize,elements); //Do the permutation
    for(i=0;i<v.size();i++) { //Print out the result
    elements=(int[]) v.get(i);
    System.out.println("");
    for(j=0;j<elements.length;j++) System.out.print(elements
    [j]+" ");
    System.out.println("\nTotal permutations = "+v.size());
    and the error I get is:
    Permutate.java:26: Incompatible type for =. Can't convert int to int[]. for(i=0;i<arg.length-1;i++) elements=Integer.parseInt(arg[i+1]);

    elements=(int[]) v.get(i);
    The above statement is illegal. Its not possible to
    use an array type in casting at all.
    Basically you are trying to do a kind of multiple
    casting, which is not possible.
    You might want to store vectors in vector v instead of
    arrays in vector v. Its better to do this.There's nothing wrong with the line
    elements = (int[]) v.get(i);
    assuming the returned object from the vector is in fact an array of int. Even then, it is a runtime exception condition not a compile-time error.
    Using arrays is perfectly valid where you know the size of the array at creation and do not need to resize it during use... The arrays are fast and compact. This is however not a comment on the approach taken in this case but merely an observation that arrays are not always an inferior choice to one of the collection classes.
    Now put up your dukes... ;)

  • Public int indexOf(int ch, int fromIdx) doesn't work for some decimal value

    I have tested two strings below. These two string are identical, except the first string has a char 'ƒ, which has a decimal value of 131. And the second string has a char 'À', which has a decimal value of 192. I am expecting the same output, which is 11, but I got -1 for the test I did using the first string. In the API for public int indexOf(int ch, int fromIndex), values of ch is in the range from 0 to 0xFFFF (inclusive). It is highly appreciated if anyone could provide any insights on why -1 returned when the first string is tested. Thank you in advance.
    String strHasDecimal131 = "Test value ƒ, it has a decimal value of 131";
    String strHasDecimal192 = "Test value À, it has a decimal value of 192";
    int badDecimal = 131;
    int idxBadDecimal = strHasDecimal131.indexOf( badDecimal, 0);
    System.out.println( "index of Bad Decimal: " + idxBadDecimal );
    The output is: index of Bad Decimal -1
    int badDecimal = 192;
    int idxBadDecimal = strHasDecimal192.indexOf( badDecimal, 0);
    System.out.println( "index of Bad Decimal: " + idxBadDecimal );
    The output is: index of Bad Decimal: 11

    Thank you everyone for your inputs. Following are the print statements and the output: for character 'ƒ' and ' À':
    System.out.println((int)'\u0083' + ", " + (int)'\u00C0' + " print decimal value" );
    Output: 131, 192 print decimal value
    System.out.println((char)'\u0083' + ", " + (char)'\u00C0' + " print character value" );
    Output: ?, À print character value
    According to Latin-1 Supplement table, the first char in the output would have the appearance of ƒ, instead it has the appearance of ?
    System.out.println( (int)'ƒ' + ", "+ (int)'À' + " print integer value");
    Output: 402, 192 print integer value
    I also have tried to print out the decimal value of following char: € &#65533; ‚ ƒ „ … † ‡, according to Latin-1 Supplement table, these char has decimal value of 128 through 135 and hex value 0x0080 through 0x0087. And the output from java println is: 8364 65533 8218 8222 8230 402 8224 8225.
    System.out.println((int)'€' + " " + (int)'&#65533;' + " " + (int)'‚' + " " +(int)'„' + " " + (int)'…' + " " +(int)'ƒ' + " " + (int)'†' + " " + (int)'‡' );
    As I did before, I print out character of decimal value of 128 through 135
    System.out.println((char)128 + " " + (char)129 + " " + (char)130 + " " +(char)131 + " " + (char)132 + " " +(char)133 + " " + (char)134 + " " + (char)135 );
    Output: ? ? ? ? ? ? ? ?
    Not sure why java prints character for decimal value of 128 through 159 differently from what appears in the Latin-1 Supplement table. Any of your inputs are appreciately.

Maybe you are looking for

  • Msi h61mu-e35-b3 sata problem

    There are times that at system boot, my sata devices such as hdd and odd is not detected by the bios therefore it will not boot to windows then go directly to bios setup. What I usually do is I connect the devices to other sata ports or tried to chan

  • Difference between 8i and 9i

    Hi all, Can anyone tell me, what were the major differences between oracle 8i and 9i..? soundar.m

  • How to change headers

    Every time HP or MS does an update, the headers & footers revert to factory settings.  How can these settings  be stabilized?  Fail to find options, but will continue to look.

  • SquirrelMail LDAP address book error

    Hello all - over the weekend I upgraded my OD Master/LDAP server and my Mail server (two separate boxes) to v10.5.5 of OS X server, and now my users are reporting that they can no longer use our LDAP-integrated address book in SquirrelMail... I tried

  • Can iPhoto work in tandem with Bridge without making duplicate copies?

    I recently purchased an iPad and want to move some photo collections on to it. I currently use Bridge to manage my collection of many thousands of images, but it obviously does not let me easily sync with any kind of i-device. I am hoping that iPhoto