LWUIT 1.5 Table - horizontal spanning problem

I am wondering if this is a bug or just my faulty code. I've been trying to render table with some horizontal spanning. This is how it should look like:

enter image description here

In LWUIT 1.4 everything worked correctly. Since 1.5 the table looks like:

enter image description here

My implementation:

DefaultTableModel model = new DefaultTableModel(new String[]{"", "", "", ""}, new String[][]{
                {"Header", null, null, null},
                {"1", "2", "3", "4"},
                {"1", "2", "3", "4"},
                {"String", null, "String", null}});


Table tab = new Table(model, false) {

        protected Component createCell(Object value, final int row, final int column, boolean editable) {
            Component c = super.createCell(value, row, column, editable);
            c.setFocusable(false);
            return c;
        }

        protected TableLayout.Constraint createCellConstraint(java.lang.Object value, int row, int column) {
            TableLayout.Constraint tlay = super.createCellConstraint(value, row, column);
            if (row == 0 && column == 0) {
                tlay.setHorizontalSpan(4);
                tlay.setHorizontalAlign(Table.CENTER);
            } else if (row == 3)) {
                if (column == 0) {
                    tlay.setHorizontalSpan(2);
                    tlay.setWidthPercentage(50);
                } else if (column == 2) {
                    tlay.setHorizontalSpan(2);
                    tlay.setWidthPercentage(50);
                }
            } else if (row != 0) {
                tlay.setWidthPercentage(25);
            }
            return tlay;
        }

    };
This question and answers originated from www.stackoverflow.com
Question by (8/15/2011 10:12:02 PM)

Answer

The bug (in LWUIT) is triggered by the tlay.setWidthPercentage(50); which you can remove and still get the expected result. It seems the width percentage value doesn't take spanning into consideration which I'm guessing it should.

You should file a bug for this in the issue tracker, thanks for the bug.

Answer by

Find More Answers
Related Topics  table  java-me  lwuit
Related Questions
  • Dynamic table in lwuit

    How to create a Dynamic table in lwuit TableModel model = new DefaultTableModel( new String[]{"A", "B", "Call Avg"}, new Object[][]{ {"0", "50", "0.00"}, {"0",…
  • Command sometimes does not work with LWUIT 1.5

    I use LWUIT 1.5 and in the " Libraries & Resources " project property I selected both LWUIT_MIDP.jar and MIDP_IO.jar . The problem is that sometimes , usually in the second Form after the mai…
  • LWUIT Blackberry TextField horizontal scroll

    I have a problem with LWUIT textfield scroll right issue. I am using it to capture an email from the user and the problem happened when the user enters an email greater than the width of the text fi…
  • HashTable to Lwuit Table

    Hashtable iHashtable=new Hashtable(); iHashtable.put("Name", "Jhon"); iHashtable.put("Address","India"); Enumeration iEnumeration=iHashtable.keys(); while(iEnumeration.hasMoreElement…
  • LWUIT : arabic font problem

    Hi how can i add arabic Characters to bitmap font and show in application ? how can i do it on localization section ? when i use system font it`s shows seprated and reserved on some phones , i want …
  • LWUIT : Form Problem

    i have started using LWUIT which sounds interesting , i have made a form and has simply added an image to its background , my problem is that the image is getting streched and looks bad :D is there …
  • LWUIT Table Layout embedded TextAreas

    my goal is to display a Table through parsing an XML file. I'm using a SAX Parser and the content has multirows and I want the table width to fit to the display. Of course Y_AXIS scrolling would …
  • LWUIT: Layout calculation problem

    I have a rather large application written with LWUIT. With only a few screens that have the problem. The problem: When the page loads, everything looks fine. but when you scroll you can't scro…
  • How to set a title for a Border with LWUIT 1.4 ? How to coloriate odd and pair Table rows?

    I use LWUIT 1.4 1) In my Form there is a Container based on a BoxLayout ( Y axis ) , there are two Label's added to this container , and I want to create a titled Border to be placed into the con…
  • Master-Slave form in LWUIT

    Small question - did anybody face a need to create master-slave form using LWUIT? The task is following: I need to have a sort of grid with order's short details, and a separate field to reflect the…