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 showForm() { | |
com.codename1.ui.List list = new com.codename1.ui.List(createGenericListCellRendererModelData()); | |
list.setRenderer(new GenericListCellRenderer(createGenericRendererContainer(), createGenericRendererContainer())); | |
Form hi = new Form("GenericListCellRenderer", new BorderLayout()); | |
hi.add(BorderLayout.CENTER, list); | |
hi.show(); | |
} | |
private Container createGenericRendererContainer() { |
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 showForm() { | |
Form hi = new Form("InfiniteContainer", new BorderLayout()); | |
Style s = UIManager.getInstance().getComponentStyle("MultiLine1"); | |
FontImage p = FontImage.createMaterial(FontImage.MATERIAL_PORTRAIT, s); | |
EncodedImage placeholder = EncodedImage.createFromImage(p.scaled(p.getWidth() * 3, p.getHeight() * 3), false); | |
InfiniteContainer ic = new InfiniteContainer() { | |
@Override | |
public Component[] fetchComponents(int index, int amount) { |
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 showForm() { | |
Form hi = new Form("InfiniteScrollAdapter", new BoxLayout(BoxLayout.Y_AXIS)); | |
Style s = UIManager.getInstance().getComponentStyle("MultiLine1"); | |
FontImage p = FontImage.createMaterial(FontImage.MATERIAL_PORTRAIT, s); | |
EncodedImage placeholder = EncodedImage.createFromImage(p.scaled(p.getWidth() * 3, p.getHeight() * 3), false); | |
InfiniteScrollAdapter.createInfiniteScroll(hi.getContentPane(), () -> { | |
java.util.List<Map<String, Object>> data = fetchPropertyData("Leeds"); | |
MultiButton[] cmps = new MultiButton[data.size()]; |
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
int pageNumber = 1; | |
java.util.List<Map<String, Object>> fetchPropertyData(String text) { | |
try { | |
ConnectionRequest r = new ConnectionRequest(); | |
r.setPost(false); | |
r.setUrl("http://api.nestoria.co.uk/api"); | |
r.addArgument("pretty", "0"); | |
r.addArgument("action", "search_listings"); | |
r.addArgument("encoding", "json"); | |
r.addArgument("listing_type", "buy"); |
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
Label left = new Label("Left", icon); | |
left.setTextPosition(Component.LEFT); | |
Label right = new Label("Right", icon); | |
right.setTextPosition(Component.RIGHT); | |
Label bottom = new Label("Bottom", icon); | |
bottom.setTextPosition(Component.BOTTOM); | |
Label top = new Label("Top", icon); | |
top.setTextPosition(Component.TOP); | |
hi.add(left).add(right).add(bottom).add(top); |
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
Form hi = new Form("Layout Animations", new BoxLayout(BoxLayout.Y_AXIS)); | |
Button fall = new Button("Fall"); | |
fall.addActionListener((e) -> { | |
if(hi.getContentPane().getComponentCount() == 1) { | |
fall.setText("Rise"); | |
for(int iter = 0 ; iter < 10 ; iter++) { | |
Label b = new Label ("Label " + iter); | |
b.setWidth(fall.getWidth()); | |
b.setHeight(fall.getHeight()); | |
b.setY(-fall.getHeight()); |
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
Form hi = new Form("Layout Animations", new BoxLayout(BoxLayout.Y_AXIS)); | |
Button fall = new Button("Fall"); | |
fall.addActionListener((e) -> { | |
for(int iter = 0 ; iter < 10 ; iter++) { | |
Label b = new Label ("Label " + iter); | |
b.setWidth(fall.getWidth()); | |
b.setHeight(fall.getHeight()); | |
b.setY(-fall.getHeight()); | |
hi.add(b); | |
} |
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
Form hi = new Form("MigLayout", new MigLayout("fillx,insets 0")); | |
hi.add(new Label("First")). | |
add("span 2 2", new Label("Second")). // The component will span 2x2 cells. | |
add("wrap", new Label("Third")). // Wrap to next row | |
add(new Label("Forth")). | |
add("wrap", new Label("Fifth")). // Note that it "jumps over" the occupied cells. | |
add(new Label("Sixth")). | |
add(new Label("Seventh")); | |
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
Form hi = new Form("GroupLayout"); | |
Label label1 = new Label(); | |
Label label2 = new Label(); | |
Label label3 = new Label(); | |
Label label4 = new Label(); | |
Label label5 = new Label(); | |
Label label6 = new Label(); | |
Label label7 = new Label(); |