Changing row height

Hi,
In an AdvancedDataGrid, is it possibe for the user to increase or decrease the row height by dragging/pulling the separations/dividers between the rows with mouse? This is similar to what we can do in an Excel sheet.
If it is possible, can anyone let me know how this can be done.
Thanks

[url http://java.sun.com/docs/books/tutorial/uiswing/events/componentlistener.html]How to Write a Component Listener
Add the listener to the frame and then reset the row height when the frame is resized.

Similar Messages

  • Change row height of a table by dragging

    Hi,
    One of my swing projects has a requirement that the user should be able to resize the height of individual rows of a table by dragging the row separator with the mouse.
    JTable by default allows us to drag the column separators and change the column width. But the row heights are not adjustable in a similar way.
    Is it possible to do so? I guess I will have to write a listener for the rows, don't know how to go about it though.
    Any help in this regard would be highly appreciated.
    Thanks.

    Hi,
    Well here is the table you're talkking about. I tried adding the cellrender and listen to the drag event. Could not proceed much though. I am still trying. In the mean time if any of you can progress on this then please let me know.
    I've attached my full code listing here.
    Thanks.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.awt.Cursor;
    public class LineNumberTable extends JTable
         private JTable mainTable;
         public LineNumberTable(JTable table){
              super();
              mainTable = table;
              setAutoCreateColumnsFromModel(false);
              setModel(mainTable.getModel());
              setSelectionModel(mainTable.getSelectionModel());
              setAutoscrolls( false );
              addColumn(new TableColumn());
              getColumnModel().getColumn(0).setCellRenderer( mainTable.getTableHeader().getDefaultRenderer());
              //Attaching my cell renderer
              getColumnModel().getColumn(0).setCellRenderer(new myCellRenderer());
              getColumnModel().getColumn(0).setPreferredWidth(10);
              setPreferredScrollableViewportSize(getPreferredSize());
         public boolean isCellEditable(int row, int column) {
              return false;
         public Object getValueAt(int row, int column) {
              return new Integer(row + 1);
         public int getRowHeight(int row) {
              return mainTable.getRowHeight();
         public static void main(String[] args) throws Exception {
              DefaultTableModel model = new DefaultTableModel(100, 5);
              JTable table = new JTable(model);
              JScrollPane scrollPane = new JScrollPane( table );
              JTable lineTable = new LineNumberTable( table );
              scrollPane.setRowHeaderView( lineTable );
              JFrame frame = new JFrame( "Line Number Table" );
              frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
              frame.setSize(400, 300);
              frame.setVisible(true);
         class myCellRenderer extends DefaultTableCellRenderer implements MouseListener, MouseMotionListener {
              private Point start;
              private Point end;
              public void mouseClicked(MouseEvent e) {
              public void mouseDragged(MouseEvent e) {
              public void mouseEntered(MouseEvent e) {
                   setCursor(new Cursor(java.awt.Frame.N_RESIZE_CURSOR));
              public void mouseExited(MouseEvent e) {
                   setCursor(new Cursor(java.awt.Frame.N_RESIZE_CURSOR));
              public void mouseMoved(MouseEvent e) {
              public void mousePressed(MouseEvent e) {
                   start = e.getPoint();
               public void mouseReleased(MouseEvent e) {
                    end = e.getPoint();
                    int inc = end.y - start.y;
                    LineNumberTable.this.setRowHeight(inc + LineNumberTable.this.getRowHeight());
    }

  • Excel 2013 randomly changes row height to 409.5 pixels

    So as I said, i open a file, and some of the rows are of the maximum possible height. For no reason. If a colleague of mine opens the same document on his/her laptop, there is no issue. This also makes scrolling almost impossible, since for some reason
    a window is not enough to cover 409.5 pixels. Is there any kind soul who could help me out?

    I haven't meet this issue, but did see similar issue many times in different forums.
    Maybe you can try the menthods mentioned in the thread below:
    http://social.technet.microsoft.com/Forums/office/en-US/47740b73-9e06-442b-94af-5fbac0956add/excel-row-height-changes-when-it-should-not-change?forum=excel

  • Change row height in new iTunes

    I need to shorten row height in new iTunes.....seems to waste a lot of space.
    Thanks

    No options for that, unless you currently have Use large text for list views selected under Edit > Preferences > General.
    tt2

  • Change row`s height

    Hi,
    How to change Row height in standart report template, if I use jquery.htmldbHscroll-0.0.1.min (which I found on this forum). Simply rows height are bit another than in colums without scrolling.
    Thank you !

    go0ze wrote:
    Hi,
    How to change Row height in standart report template, if I use jquery.htmldbHscroll-0.0.1.min (which I found on this forum). Simply rows height are bit another than in colums without scrolling.
    Thank you !Hi,
    You did found from this forum??
    Regards,
    Jari

  • Row Height Issue

    Oh Hi I have selected Optimize height by row content from Table and font tab and it shows all my text in activity name but when i saved the layout it changes back to keep current rows heights. Can any one tell me how do i fix this
    Thanks in Advanced

    *793199 ,*
    The "Row Height" issue is a common problem. Some things that affect my row height are:
    * Not saving my layout after changing row height
    * Notebook items in the gantt chart affecting the row height and may have to be manually widened to display all of the text or symbols
    Row Height*
    Optimize height by row content:* Indicates you want each row's height determined by its content. If you choose this option, type or select the maximum number of lines that should be included in each row.
    Good luck and let me know how it turns out.

  • Row height in tableheader

    hi
    how can i change row height in tableheader of JTable? i cant find any method to change it. any idea?
    thx
    rsobies

    One way -
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.util.regex.*;
    public class MultiLineTableCell extends JFrame
        private Object[][] data =
            {"This\nis\na\ncell\nwith\nsome\nlines.", "This\nis\na\ncell\nwith\nmany\nmany\nmany\nlines","Two\nLines"},
            {"A\nQuad\nRow\nline.","2\n\n\n\n\n\n\n\n\n\n\nLines",null},
            {"Just two\nlines","Just\n3\nlines","A single longer line."},
        private Object[] headers =
            "<html><body align=center>Column<br>1","<html><body align=center>Column<br>2","<html><body align=center>Column<br>3",
        MultiLineTableCell()
            super( "Multi-Line Cell Example" );
            setDefaultCloseOperation( EXIT_ON_CLOSE );
            DefaultTableModel dm = new DefaultTableModel()
                public Class getColumnClass(int columnIndex)
                    return Integer.class;
            dm.setDataVector(data, headers);
            JTable table = new JTable( dm );
            table.setDefaultRenderer(Integer.class, new MultiLineCellRenderer());
            JScrollPane scroll = new JScrollPane( table );
            getContentPane().add( scroll );
            setSize( 400, 130 );
        public static void main(String[] args)
            new MultiLineTableCell().setVisible(true);
        static public class MultiLineCellRenderer extends JList implements TableCellRenderer
            protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
            protected Pattern lineSplitterPattern = Pattern.compile("\n+");
            // We need a place to store the color the JLabel should be returned
            // to after its foreground and background colors have been set
            // to the selection background color.
            // These ivars will be made protected when their names are finalized.
            private Color unselectedForeground;
            private Color unselectedBackground;
            public MultiLineCellRenderer()
                super();
                setOpaque(true);
                setBorder(noFocusBorder);
                ListCellRenderer renderer = getCellRenderer();
                ((JLabel)renderer).setHorizontalAlignment(JLabel.CENTER);
             * Overrides <code>JComponent.setForeground</code> to assign
             * the unselected-foreground color to the specified color.
             * @param c set the foreground color to this value
            public void setForeground(Color c)
                super.setForeground(c);
                unselectedForeground = c;
             * Overrides <code>JComponent.setBackground</code> to assign
             * the unselected-background color to the specified color.
             * @param c set the background color to this value
            public void setBackground(Color c)
                super.setBackground(c);
                unselectedBackground = c;
            public Component getTableCellRendererComponent(JTable table, Object value,
                    boolean isSelected, boolean hasFocus, int row, int column)
                if (isSelected)
                    super.setForeground(table.getSelectionForeground());
                    super.setBackground(table.getSelectionBackground());
                else
                    super.setForeground((unselectedForeground != null) ? unselectedForeground
                            : table.getForeground());
                    super.setBackground((unselectedBackground != null) ? unselectedBackground
                            : table.getBackground());
                setFont(table.getFont());
                if (hasFocus)
                    Border border = null;
                    if (isSelected)
                        border = UIManager.getBorder("Table.focusSelectedCellHighlightBorder");
                    if (border == null)
                        border = UIManager.getBorder("Table.focusCellHighlightBorder");
                    setBorder(border);
                    if (!isSelected && table.isCellEditable(row, column))
                        Color col = UIManager.getColor("Table.focusCellForeground");
                        if (col != null)
                            super.setForeground(col);
                        col = UIManager.getColor("Table.focusCellBackground");
                        if (col != null)
                            super.setBackground(col);
                else
                    setBorder(noFocusBorder);
                String str = (value == null) ? "" : value instanceof String ? (String)value : value.toString();
                String[] lines = lineSplitterPattern.split(str);
                setListData(lines);
                table.setRowHeight(row, Math.max(getPreferredSize().height, table.getRowHeight(row)));
                return this;
    }

  • Financial Reporting 9.3.1 automatically change the height of the row

    How can I make the reports generator automatically change the height of the row if the text does not fit into the cell? I tried different PDF generators (AFPL Ghostscript 8.51, Adobe Acrobat Distiller 6.0) but result was the same: http://sql.ru/forum/actualfile.aspx?id=6396177

    Hi,
    In HFR if you are not allowing expansion on the row or column, it wont expand itself according text length.
    So you need to anticipate the row hight and width according to your need. You can define this in the property sheet.
    Thanks,
    aly

  • CSS issue when changing the table row height to 16px

    Hello,
    After changing the table row height through css like this:
    .table-row-cell, .table-cell {
    -fx-cell-size: 16;
    the table rows are correctly displayed with a 16px height but the cell bottoms seem to be incorrectly set.
    For example the following css style (a red 3px bottom border):
    .table-cell {
    -fx-border-width: 0 0 3 0;
    -fx-border-color: red;
    doesn't work anymore with the new row height whereas it works with the 24px standard row height.
    While investigating with Scenic View, I noticed that changing the row height changes the TableRow layoutBounds height (from 24px to 16px so that's ok) but not the boundsInParent height which remains to 27px. I think it should become 19px (16 + 1.5 + 1.5). I don't know if it's a bug.
    Anyway, any help making the css red border working for a 16px row height would be greatly appreciated.
    Regards,
    Bruno.

    Q: Would this help to just use absolute div tags and give me 'ABSOLUTELY ABSOLUTE' positioning?
    No.  APDivs are not a good primary layout method.  Use default CSS positioning (which is no positioning at all).  Align page elements with margins, floats and padding.
    See example -- 2-Column CSS Layout with Grids
    (View Page Source in your browser to see the code)
    http://alt-web.com/TEMPLATES/2-col-fixed-with-grid.shtml
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb
    www.alt-web.blogspot.com

  • Where do I Change Table Row Height with Styles?

    I have created a lot of tables in the same document, and now I want to change the height of them. I have used Table Styles and Cell Styles, to be able to change things like this in *one* place instead of the 100 different tables...
    I can't find where I alter the Cell Height (aka Row Height) in any of the styles. What have I missed?
    Please help!

    @Andreas – nothing. You missed nothing. You cannot define cell height or width with cell styles…
    However you can do so with scripting. But not directly in scripting a property of the cell style, but in iterating through all table cells, finding out its cell style and acting on the cell directly (height, minimumHeight, maximumHeight and autoGrow properties).
    Another scenario would be using a special plug-in like "Smart Styles" from Woodwing.
    Uwe

  • To change the height of row of a table

    hi Experts,
    1) Can any one please help me to change the height of row of a table
    2) If i need to display data intable in such a way that data would be displayed in every alternate row, keeping one row empty.
    Points wil be rewarded to helpful answers,
    Regards,
    Sanjyoti.

    hi Jarrod, 
    i want to make a display iview where the data comes from a table, add image beside each data from the table,
    1) if i display data in table i am not able to add image beside each row.
    2)i have also tried using one form and one table displayed side by side where the table has data from data service and form has the images (static), but here again as the height of row can not be changed the image does not fit perfectly beside the rows.
    I have not worked in VC before, so dont know wat exactly cant be done,
    hope you will guide if you have any idea wat could be done
    I got the help given below but not able to understand the flow of what is done 
    First create a button to trigger an action (let's say the action is called "go").
    Drag a line and create a signal out set go as the event, name the signal out as "sig".
    Create 4 numeric fields in the signal out "num1",..,"num4".
    Map num1 <- 1
    Add a signal in to the model, name it "sig" and create 4 numeric field to it ("num1",..,"num4" as well).
    Drag a line from the signal in and choose a form from the context menu.
    4 recordsl will appear in the form. set them as visible and as spinner control.
    drag a line from the form's out port and add a signal out named "go".
    Map is as follows:
    num1 <= @num1+1
    num2 <= 1
    num3 <= if(@num2==1,1,0)
    num4 <= if@num3==1,1,0)
    Add a gaurd condition to the line @num1<4 and name the event "Next_Event"
    double click on num1 to open the properties popup.
    For num1 define a custom action named "Next_Event"
    For num2 define a custom action named "Pass1"
    For num3 define a system action move row - move next
    For num4 define a custom action named "pass2"
    drag a line from the form and add data store. Create 2 field in it "first" and "second"
    set the event to be pass1 and map the value you want from the table to "first".
    Create another line from the form to the data store with event pass 2 that maps value to second.
    Create a new form with 2 field which default vlaue is the value in the data store.
    Points would be awarded to helpful answers. 
    Regards,
    Sanjyoti.

  • Excel row height changes when it should not change

    I have a client using Office 2010 on a Citrix server. They are using Windows XP Pro SP3 for the desktop and the server is running Windows Server 2003 R2 STD.
    I have two users working in a spreadsheet in Excel 2010. The spreadsheet opens fine and they can perform their updates by either adding manually or doing a cut and paste. The problem comes up when all of the sudden a number of rows in the spreadsheet
    change height for not reason. The spreadheet has the row height set to 14.5 but for some reason the rows that change height sent the height to 405.9. Usually all the user has to do is go back and reset the row height on these cells and save before they can
    go back to making changes.
    It's more annoying then anything else so if someone could provide any solutions, it would be greatly apppreciated.
    thanks, Joe Trainor
    Joseph Trainor [email protected] Weidenhammer Systems Wyomissing, PA

    I have been working with Excel for 20years, and have been hit with this resizing of row height and also drawings or shapes, after opening an old XL97-2003 file.
    Chad's method below works!
    Please try the following to resolve the issue:
    1. Boot Excel 2010
    2. Open [Excel Options] dialog. ([File]-[Options])
    3. Select [Advanced] tab, turn on [Cut, copy and sort inserted objects with their parent cells] option. (In [Cut, copy and paste] section)
    *This will not resize rows that are currently set to 409.5 but I would like to know if this keeps rows from doing this in the future.
    1) I found that after opening the workbooks the row height and shapes are correct.
    2) Save the file, then save as to the new .xlsx format (for a macro free workbook)
    3) After reverting to former; turn OFF[Cut, copy and sort inserted objects with their parent cells] option. (In [Cut, copy and paste] section), and then opening the XL97-2003 files, the fault is still there.  For the newer xlsx files, though,
    the fault has gone.
    4) So yes, Chad, it does keep rows from doing this in future, if the newer file format is used.  Thanks.
    Chad's answer is "the answer"!

  • Why can't i change row and column height in tables?

    a mind-boggling problem to be sure. For some odd reason, I can't use the inspector to type in row/column heights for tables. I can use the up/down arrows, but those only work in increments of 1. I can manually adjust them one by one but as soon as I edit text in a different table cell, I have to start all over again. Does anyone else have this problem?

    Hi Gerry & Ric
    I had already tried both of your suggestions without any luck but I appreciate the help anyway. I should've been a bit more specific: I can actually type in the column/row height windows, but when I press return or tab, Pages ignores the numbers. I've tried using both the number pad and the regular keyboard numbers and every manner of clicking, enter, tab, control, alt......there must be some setting with my computer that is causing an incompatibility with Pages. Boh!
    Susie

  • 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

  • Report Generation Toolkit Table Row Height-MS Word

    I am having trouble setting the table row height in the report generation toolkit. I can set the column width fine, but the row height seems to remain the same no matter what I set it to. I have attached the VI that generates and formats the table, and the printout it is resulting in. I have also attached the template file I am using.
    Any tips to get this to work right? I am trying to make the cells exactly the same height as the text inside. 
    Solved!
    Go to Solution.
    Attachments:
    AddMarkersToReport.vi ‏20 KB
    badFormatting.pdf ‏179 KB
    splitter.docx ‏13 KB

    Hi,
    So I tried .2  and it didn't work.  So I went to Word to manually change it, and it did not work either.  There is a selection box in word, for the table properties, that seems to default to the value "at least".  When I changed this manually to "exactly" in word, no problem with the .2 manually in Word.
    Hopefully this can be set within the template, for all new inserted tables.  I'm not sure the report generator VI's expose this property.  Well, this is a start for the issue.
    Edit ****
    You can go into the add table VI and expose the property.  See pic.   However, you have to decide if you want to "upgrade" this VI permanently to expose this property or make a copy with the property exposed.   I haven't messed with the new class reports too much, so not sure of the ins and outs with this.
    I think this is the issue with the row size becoming smaller.
    Mark Ramsdale

Maybe you are looking for

  • One multiple day event won't show in month view

    I have noticed that every time I launch iCal an event (checked for all day event) beginning 9/1 and ending 9/4 will not show up in the month view until I open that day (and it's there) click it and then it will show up as a banner event. If I close i

  • Sender File Adapter should run only when trigger file is found PI 7.1

    I am using PI 7.1 . I have a File Sender Adapter communication channel that needs to poll for a trigger file - input.trg  . Only If that is found then it needs to pick up the actual data file -  input.dat   .  The Transport Protocol is  FTP not NFS,

  • Trace not showing Global container variable at mapping test time.

    Hi Folks , I have a scenario file to Proxy scenario. At mapping time I am doing a lookup inside a UDF using JCO connections. Lookup is taking 2 fields(ex X an dY) as input and coming up with couple of fields in output. Output fileds I am storing in g

  • Sync movies to iPhone & Apple TV

    If I want to sync a movie to both an iPhone & an Apple TV, it seems that I need to load the video into iTunes twice. If I load up a copy set to the appropriate resolution for the iPhone, it doesn't look as good as it should on the Apple TV. If I load

  • Update to os 5.1 and now the white screen!!

    hi all, I just updated to os 5.1 and now i have the white screen after 3-5 sec of the apple logo. I have tried the sleep   home button pressed together but it did not help. Including when connected to the power cord. Pls help!!! thanks, a