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.

Similar Messages

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

  • OLAPDatagrid wordwrap and variable row height

    Hi,
       Does anyone have an idea how to get wordwrap and  variablerowheight work for OLAPDataGrid, Here is the example which I am  trying but it is not working.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="creationCompleteHandler()">
    <mx:Script>
        <![CDATA[
    import mx.rpc.AsyncResponder;
            import mx.rpc.AsyncToken;
            import mx.olap.OLAPQuery;
            import mx.olap.OLAPSet;
            import mx.olap.IOLAPQuery;
            import mx.olap.IOLAPQueryAxis;
            import mx.olap.IOLAPCube;
            import mx.olap.OLAPResult;
            import mx.events.CubeEvent;
            import mx.controls.Alert;
            import mx.collections.ArrayCollection;
            // Format of Objects in the ArrayCollection:
            //  data:Object = {
            //    customer:"AAA",
            //    product:"ColdFusion",
            //    quarter:"Q1"
            //    revenue: "100.00"
            [Bindable]
            private var flatData:ArrayCollection = new ArrayCollection(
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"ColdFusion", quarter:"Q1", revenue:210, cost:25},
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"Flex", quarter:"Q2", revenue:210, cost:25},
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"Dreamweaver", quarter:"Q3", revenue:250, cost:125},
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"Flash", quarter:"Q4", revenue:430, cost:75},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"ColdFusion", quarter:"Q2", revenue:125, cost:20},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"Flex", quarter:"Q3", revenue:210, cost:20},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"Dreamweaver", quarter:"Q4", revenue:320, cost:120},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"Flash", quarter:"Q1", revenue:280, cost:70},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"ColdFusion", quarter:"Q3", revenue:375, cost:120},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"Flex", quarter:"Q4", revenue:430, cost:120},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"Dreamweaver", quarter:"Q1", revenue:470, cost:220},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"Flash", quarter:"Q2", revenue:570, cost:170},
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"ColdFusion", quarter:"Q4", revenue:215, cost:90},
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"Flex", quarter:"Q1", revenue:210, cost:90},
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"Dreamweaver", quarter:"Q2", revenue:175, cost:190},
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"Flash", quarter:"Q3", revenue:670, cost:75},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"ColdFusion", quarter:"Q1", revenue:175, cost:20},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"Flex", quarter:"Q2", revenue:210, cost:20},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"Dreamweaver",quarter:"Q3", revenue:120, cost:120},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"Flash", quarter:"Q4", revenue:310, cost:70},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"ColdFusion", quarter:"Q1", revenue:385, cost:120},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"Flex", quarter:"Q2", revenue:340, cost:120},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"Dreamweaver", quarter:"Q3", revenue:470, cost:220},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"Flash", quarter:"Q4", revenue:270, cost:170},
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"ColdFusion", quarter:"Q1", revenue:100, cost:25},
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"Flex", quarter:"Q2", revenue:150, cost:25},
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"Dreamweaver", quarter:"Q3", revenue:200, cost:125},
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"Flash", quarter:"Q4", revenue:300, cost:75},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"ColdFusion", quarter:"Q2", revenue:175, cost:20},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"Flex", quarter:"Q3", revenue:100, cost:20},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"Dreamweaver", quarter:"Q4", revenue:270, cost:120},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"Flash", quarter:"Q1", revenue:370, cost:70},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"ColdFusion", quarter:"Q3", revenue:410, cost:120},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"Flex", quarter:"Q4", revenue:300, cost:320},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"Dreamweaver", quarter:"Q1", revenue:510, cost:220},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"Flash", quarter:"Q2", revenue:620, cost:170},
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"ColdFusion", quarter:"Q4", revenue:215, cost:90},
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"Flex", quarter:"Q1", revenue:210, cost:90},
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"Dreamweaver", quarter:"Q2", revenue:175, cost:190},
             {customer:"AAA AAA AAA AAA AA AAAAA AAAA AA", product:"Flash", quarter:"Q3", revenue:420, cost:75},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"ColdFusion", quarter:"Q1", revenue:240, cost:20},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"Flex", quarter:"Q2", revenue:100, cost:20},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"Dreamweaver", quarter:"Q3", revenue:270, cost:120},
             {customer:"BBB BB BBBBB BBB BBB BBB BBB BBB BBB BBBB", product:"Flash", quarter:"Q4", revenue:370, cost:70},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"ColdFusion", quarter:"Q1", revenue:375, cost:120},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"Flex", quarter:"Q2", revenue:420, cost:120},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"Dreamweaver", quarter:"Q3", revenue:680, cost:220},
             {customer:"CCC CCC CCCCC CCCC CCCCCCCCC CCC CCC", product:"Flash", quarter:"Q4", revenue:570, cost:170}        
            private function creationCompleteHandler():void {
                // You must initialize the cube before you
                // can execute a query on it.
                myMXMLCube.refresh();
            // Create the OLAP query.
            private function getQuery(cube:IOLAPCube):IOLAPQuery {
                // Create an instance of OLAPQuery to represent the query.
                var query:OLAPQuery = new OLAPQuery;
                // Get the row axis from the query instance.
                var rowQueryAxis:IOLAPQueryAxis =
                    query.getAxis(OLAPQuery.ROW_AXIS);
                // Create an OLAPSet instance to configure the axis.
    //            var productSet:OLAPSet = new OLAPSet;
    //            // Add the Product to the row to aggregate data
    //            // by the Product dimension.
    //            productSet.addElements(
    //                cube.findDimension("ProductDim").findAttribute("Product").children);
    //            // Add the OLAPSet instance to the axis.
    //            rowQueryAxis.addSet(productSet);
                var productSet:OLAPSet = new OLAPSet;
                // Add the Product to the row to aggregate data
                // by the Product dimension.
                productSet.addElements(
                    cube.findDimension("CustomerDim").findAttribute("Customer").children);
                // Add the OLAPSet instance to the axis.
                rowQueryAxis.addSet(productSet);
                // Get the column axis from the query instance, and configure it
                // to aggregate the columns by the Quarter dimension.
                var colQueryAxis:IOLAPQueryAxis =
                    query.getAxis(OLAPQuery.COLUMN_AXIS);        
                var quarterSet:OLAPSet= new OLAPSet;
                quarterSet.addElements(
                    cube.findDimension("QuarterDim").findAttribute("Quarter").children);
                colQueryAxis.addSet(quarterSet);
                return query;      
            // Event handler to execute the OLAP query
            // after the cube completes initialization.
            private function runQuery(event:CubeEvent):void {
                // Get cube.
                var cube:IOLAPCube = IOLAPCube(event.currentTarget);
                // Create a query instance.
                var query:IOLAPQuery = getQuery(cube);
                // Execute the query.
                var token:AsyncToken = cube.execute(query);
                // Setup handlers for the query results.
                token.addResponder(new AsyncResponder(showResult, showFault));
            // Handle a query fault.
            private function showFault(result:Object, token:Object):void {
                Alert.show("Error in query.");
            // Handle a successful query by passing the query results to
            // the OLAPDataGrid control..
            private function showResult(result:Object, token:Object):void {
                if (!result) {
                    Alert.show("No results from query.");
                    return;
                myOLAPDG.dataProvider= result as OLAPResult;           
        ]]>
    </mx:Script>
    <mx:OLAPCube name="FlatSchemaCube"
        dataProvider="{flatData}"
        id="myMXMLCube"
        complete="runQuery(event);">
        <mx:OLAPDimension name="CustomerDim">
            <mx:OLAPAttribute name="Customer" dataField="customer"/>
            <mx:OLAPHierarchy name="CustomerHier" hasAll="true">
                <mx:OLAPLevel attributeName="Customer"/>
            </mx:OLAPHierarchy>
        </mx:OLAPDimension>
        <mx:OLAPDimension name="ProductDim">
            <mx:OLAPAttribute name="Product" dataField="product"/>
            <mx:OLAPHierarchy name="ProductHier" hasAll="true">
                <mx:OLAPLevel attributeName="Product"/>
            </mx:OLAPHierarchy>
        </mx:OLAPDimension>
        <mx:OLAPDimension name="QuarterDim">
            <mx:OLAPAttribute name="Quarter" dataField="quarter"/>
            <mx:OLAPHierarchy name="QuarterHier" hasAll="true">
                <mx:OLAPLevel attributeName="Quarter"/>
            </mx:OLAPHierarchy>
        </mx:OLAPDimension>
        <mx:OLAPMeasure name="Revenue"
            dataField="revenue"
            aggregator="SUM"/>
    </mx:OLAPCube>
        <mx:Panel title="OLAPCube Control Example"
            height="75%" width="75%" layout="horizontal"
            paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">
            <mx:OLAPDataGrid id="myOLAPDG" width="100%" height="100%" variableRowHeight="true" wordWrap="true"/>
        </mx:Panel>
    </mx:Application>
    Regards,
    Alex

    This is my input data
    all other styles are working , the height or line-height properties are not working

  • JTable and selected row

    Hi,
    I'm new to Java, I'm writing a simple application using Swing, I've almost finished, almost, becose I have a jTabbedPane on 1st pane some labels and text fields, and on the second one jTable, I have to do 2 things:
    When row in JTable is selected, then the same user data should bevisible in JTabbedPane/Panel1 and if I select someon in panel1 then also the person in the jTable should be selected, what should I do? What's the function name? Please help.

    http://java.sun.com/docs/books/tutorial/uiswing/events/eventsandcomponents.html

  • Increasing the row height in crm 2011

    Hi,
         I am using crm 2011, I want increase the row height in a view, so that it can display the description in multiple rows.
    any information will be helpful.

    In views you can only specify column width and not row height.
    For columns that have large data, taking the mouse over the column will display the text in the tooltip.
    HTH 
    Sam 
    Dynamics CRM MVP |
    Inogic | http://inogic.blogspot.com|
    news at inogic dot com
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

  • How to reduce the row height

    Hi All,
    Is it possible to reduce the row height of a table.Actually the font is small and the row height is more.I dont want to redcuse the width only row height.
    Regards,
    Amrit

    does anyone of u havea ny idea on how to achiieve this.

  • 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

  • Report Row Height and Column Width

    Hi,
    I have a cell in a report (a description column) that causes the row height to become very large (when there is a lot of text in the description). I can make the column wider on the report attributes page, but there doesn't seem to be any place to influence the maximum height of a row on a report, short of modifying the template.
    Adding style attributes (e.g. max-height:30px) to an element only affects the <span> that the element resides in, not the table cell or row.
    Displaying the column as a text area is a useful workaround. The downside is the border and scroll bars do waste a lot of screen real estate. Does there exist some other way of setting a limit on the height and/or width of a report, report column or report row?
    Oh, and another question- how do make line breaks in this forum? There's no support for <BR> or [br].

    Please reply to this thread, my customer is facing the same issue. He does not have issue with the excel and the pdf output but in the rtf output the table heght increases to accomadate the data.He want it to bevave in the same way as the pdf do.
    Regards,
    Ajay

  • Interactive Report Column Headings and Row Height

    I am using the div style="width:350px;" method to control the width of columns in various interactive reports. That works fine except for the following:
    1. When creating filters, the <div...> stuff shows up along with the actual column heading, thus confusing some end users
    2. Even when I uncheck the "Use same text for single row view" checkbox and then provide a simple single row view label, the <div> stuff still shows up on the single row view
    Does anyone have a better solution?
    Also, does anyone know of a way to limit the row height within an interactive report row? I have some columns of data that contain a large amount of HTML data and I'd like to be able to limit the number of rows that show on the report.
    Is Oracle planning to provide some better control over the Interactive Report columns in another version? The Interactive Report is such a huge improvement in usability in APEX - it would be great to take it to another level by providing some better control over column width and row height.
    Edited by: DaleB on Jun 18, 2009 8:54 AM
    Edited by: DaleB on Jun 18, 2009 8:54 AM

    Dale,
    Unfortunately we don't have much we can use to do what you would like. I would have said it's impossible until version 4 but you could actually do something similar to what Roel has done. His trick is in the edit button. He changed the edit button to use an "onload" call to a JavaScript process. You could do the same but call a process that goes across the rows and styles each column. Now because you don't have a way to identify the column (can't use the order because the end user could change it) you'll have to write the code to look at the top row first and then style the appropriate column. As far as I can tell, this would be quite difficult and inefficient. Having said that if you need it that bad and would like some help with it, put up an example application on apex.oracle.com and provide the workspace/username/password and I'll take a look.
    Regards,
    Dan
    http://danielmcghan.us
    http://sourceforge.net/projects/tapigen
    You can reward this reply by marking it as either Helpful or Correct ;-)

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

  • Table Component and Row Height

    I am using XCelsius 4.5 and using the table component.  Is there anyway the row height on the table component can be linked to the Excel file?  It is not dynamically changing or wrapping text based on the amount of data that is imported in.

    Judging from the stack trace this has nothing to do with your variable row height. You are simply not respecting some array bounds (maybe your data array for the table model) when you insert the new row.
    In newRouteFare() do you fire a tableRowsInserted event? Or something similar? Check the rows passed into the Event object to see if you are exceeding the limits of the current table model.
    Thomas

  • Set row height and column witdh in Report Designer

    All,
    Is there any way to enter value of a row height or a column width by numbers, instead of dragging them, which I find stupid, especially if several rows should have same height (or several columns same width). I looked for something like Properties-Size/Width/Height but didn't find any. Did I miss anything?
    Cheers!
    /RB

    For those who come from other programming language specially web development, designer or Analyzer looks stupid, but it is very powerful tool. If you need to manage the width and height, then please explore the options in Table Interfaces, there you will be able to use your programming skills.
    thanks.
    Wond

  • Emergency - resize JTable's row height

    Hi,there!
    Could I modify the row height by mouse drag just like modify column width?
    Some codes are better.
    Thanks a lot!

    Check out the link shown below and vote for it... may be sun will fix it a little faster:
    http://developer.java.sun.com/developer/bugParade/bugs/4714237.html
    ;o)
    V.V.

  • Row height betweeen the elements H2 and P

    I would like to set the row height between the <h2>What this is</h2> <p>A simple page put together using HTML</p>.
    The space is too high for me and I need do make the height smaller. How to do it?
    Thank you.
    <body> <h1>My first web page</h1>  <h2>What this is</h2> <p>A simple page put together using HTML</p>  <h2>Why this is</h2> <p>To learn HTML</p> </body>

    Both P and H2 tags have inherit values for margins and padding and it's possible there is also values in your CSS.  Without seeing your code it's impossible to say whether that is at play or not.  All you can do is set the margin and padding from the CSS panel or set it in the code manually (see below links).
    http://www.w3schools.com/css/css_padding.asp
    http://www.w3schools.com/css/css_margin.asp

  • When I change the row heights in a spreadsheet, then save, close, and open it, the row heights are back to default. How can I prevent this?

    One of our reports has lots of text in some rows. I import the data, adjust the row width and ask the text to wrap, which automatically sets the row height appropriately. When I save, close, and open that spreadsheet, the width is still the same and Wrap is still selected, but the rows are only one line high, which means that the report is unreadable and a serious pain to make readable.
    I can save it as a PDF, but I'd rather be able to use the Numbers format or Excel and be confident that my recipients can read it.

    Hi k,
    I'm unable to reproduce the described behaviour.
    The document containing the table below has a combination of row heights set manually using teh stepper in the Table Inspector (both 0.76" labeled rows), set manually by dragging the row boundary between row reference tabs (labeled 1/13"), and set automatically by Numbers to fit the content of the remaining cells.
    Content in the rows with names beginning E, F, G or H wraps automatically to form two rows in the cell. The rest are forced into two lines using a carriage return character.
    All maiintained their row heights through two Saves and reopenings.
    Regards,
    Barry

Maybe you are looking for

  • Xcode Error won't compile any new projects!?

    If you can help, please do. I have been having this problem for a whole day now and its really becoming a pain in the head. Whenever I create a new project (Im working in C and Objective-C) even if don't write any code and just try and run the starte

  • No progress bar when embedding/viewing QT movie.

    Hi everyone, I am having an issue I've not had before. I have setup a web page with HTML to embed a Quicktime 7 movie file (exported as a download, not as streaming since my web host doesnt support QT streaming). With previous versions of QT I recall

  • Bridge keywords not working ....

    I have recently upgraded to Photoshop Cs5 / Bridge CS4. As part of this u/g my system seems to have lost the keywords that were added in the older version. I cannot find the .plist file which is where i think this information is held. How can I ask B

  • Clipping mask over sunbeam changes transparency / appearance?

    Hi, Quick question: I have a poster that contains a sunbeam vector (like the shape found in photoshop "shapes" - circle with beams that project outward). Anywho, I have this shape in my illustrator file and need to clip the edges off for the client w

  • Blackberry Pearl keeps turning itself on and off then searching for network...........

    Hi people, not sure if anybody can help however I have a Blackberry Pearl 9105 and for the past 2 weeks its keeps turning itself off and on and also keeps saying 'searching for network' at random times.  I therefore thought it may require a new batte