Last active
October 23, 2015 21:41
-
-
Save igo211/c09b6d721ce70b8572ab to your computer and use it in GitHub Desktop.
Main class start method for both Codenameone issues: #1416 & #1417
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void start() | |
{ | |
if (current != null) | |
{ | |
current.show(); | |
return; | |
} | |
Form hi = new Form("Basic memory leakage test"); | |
Container mainContainer = hi.getContentPane(); | |
BorderLayout layout = new BorderLayout(); | |
mainContainer.setLayout(layout); | |
mainContainer.setScrollableX(false); | |
mainContainer.setScrollableY(false); | |
mainContainer.setTensileDragEnabled(false); | |
mainContainer.setAlwaysTensile(false); | |
mainContainer.addComponent(BorderLayout.CENTER, new VertIC()); | |
hi.show(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.whoztop.ictest; | |
import com.codename1.ui.Component; | |
import com.codename1.ui.InfiniteContainer; | |
import com.codename1.ui.Label; | |
public class VertIC extends InfiniteContainer | |
{ | |
private static final int ITEMS_IN_ONE_GULP = 1000; | |
public VertIC() | |
{ | |
super(ITEMS_IN_ONE_GULP); | |
} | |
public Component[] fetchComponents(int index, int amount) | |
{ | |
if (index > (ITEMS_IN_ONE_GULP - 1)) | |
{ | |
return null; | |
} | |
Component[] comps = new Component[amount]; | |
for (int i=0; i<amount; i++) | |
{ | |
int cmpCnt = index + i; | |
String lblTxt = "My index is: " + cmpCnt; | |
Label lbl = new Label(lblTxt); | |
lbl.setName(lblTxt); | |
comps[i] = lbl; | |
} | |
return comps; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment