lwuit
  1. lwuit
  2. LWUIT-468

Strange Layout - scrollbar size wrong, List Elements not shown - fixed by BoxLayout.Y_AXIS

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: current
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Hello all,

      this code looks really strange some List Elements are not displayed, only their line number is there,
      the scrollbar size is way to long.

      This gets fixed if I uncommented the line // searchForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

      This is one test case for some scrollbar problems I'm facing in a larger application.
      What gives?

      import java.io.IOException;
      import java.util.Vector;

      import com.sun.lwuit.Display;
      import com.sun.lwuit.Form;
      import com.sun.lwuit.Image;
      import com.sun.lwuit.Label;
      import com.sun.lwuit.List;
      import com.sun.lwuit.TextField;
      import com.sun.lwuit.geom.Dimension;
      import com.sun.lwuit.layouts.BorderLayout;
      import com.sun.lwuit.layouts.BoxLayout;
      import com.sun.lwuit.layouts.FlowLayout;
      import com.sun.lwuit.list.DefaultListModel;
      import com.sun.lwuit.plaf.UIManager;
      import com.sun.lwuit.util.Resources;

      public class Bug extends javax.microedition.midlet.MIDlet {

      DefaultListModel searchList = new DefaultListModel();
      static Vector sortedKeywords = new Vector();

      public void startApp() {
      sortedKeywords.addElement("a");
      sortedKeywords.addElement("b");
      sortedKeywords.addElement("c");
      sortedKeywords.addElement("d");
      sortedKeywords.addElement("e");
      sortedKeywords.addElement("f");
      sortedKeywords.addElement("g");
      sortedKeywords.addElement("h");
      sortedKeywords.addElement("i");
      sortedKeywords.addElement("j");
      sortedKeywords.addElement("k");
      sortedKeywords.addElement("l");
      sortedKeywords.addElement("m");
      sortedKeywords.addElement("n");
      sortedKeywords.addElement("a");
      sortedKeywords.addElement("b");
      sortedKeywords.addElement("c");
      sortedKeywords.addElement("d");
      sortedKeywords.addElement("e");
      sortedKeywords.addElement("f");
      sortedKeywords.addElement("g");
      sortedKeywords.addElement("h");
      sortedKeywords.addElement("i");
      sortedKeywords.addElement("j");
      sortedKeywords.addElement("k");
      sortedKeywords.addElement("l");
      sortedKeywords.addElement("m");
      sortedKeywords.addElement("n");
      sortedKeywords.addElement("a");
      sortedKeywords.addElement("b");
      sortedKeywords.addElement("c");
      sortedKeywords.addElement("d");
      sortedKeywords.addElement("e");
      sortedKeywords.addElement("f");
      sortedKeywords.addElement("g");
      sortedKeywords.addElement("h");
      sortedKeywords.addElement("i");
      sortedKeywords.addElement("j");
      sortedKeywords.addElement("k");
      sortedKeywords.addElement("l");
      sortedKeywords.addElement("m");
      sortedKeywords.addElement("n");

      Display.init(this);
      Form searchForm = new Form();
      final TextField searchArea = new TextField();
      searchForm.addComponent(searchArea);
      //searchList.removeAll();
      for (int i = 0; i < sortedKeywords.size(); i++)

      { String s = (String) sortedKeywords.elementAt(i); searchList.addItem(s); }

      System.out.println(sortedKeywords.size());
      final List searchL = new List(searchList);
      searchForm.addComponent(searchL);

      Label l = new Label(Integer.toString(searchL.size()));
      searchForm.addComponent(l);

      // with BoxLayout.Y everything is fine!
      // searchForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

      searchForm.show();
      }

      public void pauseApp() {
      }

      public void destroyApp(boolean unconditional) {
      }
      }

        Activity

        Hide
        vprise added a comment -

        Duplicate of 467

        Show
        vprise added a comment - Duplicate of 467

          People

          • Assignee:
            Unassigned
            Reporter:
            cond
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: