开发者

TextArea in Table Cell strange issue

开发者 https://www.devze.com 2023-04-09 03:38 出处:网络
I have worked with javame + lwuit. I encountered an unusual behavior of textarea, when it is inside table cell. Originally textarea ыhifted to right over edge of cell, then I set a fixed size, the p

I have worked with javame + lwuit.

I encountered an unusual behavior of textarea, when it is inside table cell. Originally textarea ыhifted to right over edge of cell, then I set a fixed size, the problem goes away, but there was another - even though that textarea was stretched to full screen, the text is drawn according to old boundaries.

This looks like:

+++++++++++++++++++++++++++++++

+ This text would                                        +

+ fit, but somehow                                      +

+ transferred to                                           +

+ another line                            &nb开发者_开发技巧sp;                 +

+++++++++++++++++++++++++++++++

Please help if you are faced with similar problems or know what it was.


Cells in a table take up their preferred width or the cell constraint percentage if one is defined.

Preferred width for a text field/text area is calculated based on the columns value for the text area/text field. E.g. to increase the preferred width of a text area just increase the columns by deriving Table and overriding createCell like this:

protected Component createCell(Object value, int row, int column, boolean editable) {
    Component c = super.createCell(value, row, column, editable);
    if(c instanceof TextArea) {
         ((TextArea)c).setColumns(50);
    }
    return c;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号