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
final Form hi = new Form("MediaPlayer", new BorderLayout()); | |
hi.setToolbar(new Toolbar()); | |
Style s = UIManager.getInstance().getComponentStyle("Title"); | |
FontImage icon = FontImage.createMaterial(FontImage.MATERIAL_VIDEO_LIBRARY, s); | |
hi.getToolbar().addCommandToRightBar(new Command("", icon) { | |
@Override | |
public void actionPerformed(ActionEvent evt) { | |
Display.getInstance().openGallery((e) -> { | |
if(e != null && e.getSource() != null) { | |
String file = (String)e.getSource(); |
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("Swipe Tabs", new LayeredLayout()); | |
Tabs t = new Tabs(); | |
t.hideTabs(); | |
Style s = UIManager.getInstance().getComponentStyle("Button"); | |
FontImage radioEmptyImage = FontImage.createMaterial(FontImage.MATERIAL_RADIO_BUTTON_UNCHECKED, s); | |
FontImage radioFullImage = FontImage.createMaterial(FontImage.MATERIAL_RADIO_BUTTON_CHECKED, s); | |
((DefaultLookAndFeel)UIManager.getInstance().getLookAndFeel()).setRadioButtonImages(radioFullImage, radioEmptyImage, radioFullImage, radioEmptyImage); | |
Container container1 = BoxLayout.encloseY(new Label("Swipe the tab to see more"), |
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("Tabs", new BorderLayout()); | |
Tabs t = new Tabs(); | |
Style s = UIManager.getInstance().getComponentStyle("Tab"); | |
FontImage icon1 = FontImage.createMaterial(FontImage.MATERIAL_QUESTION_ANSWER, s); | |
Container container1 = BoxLayout.encloseY(new Label("Label1"), new Label("Label2")); | |
t.addTab("Tab1", icon1, container1); | |
t.addTab("Tab2", new SpanLabel("Some text directly in the tab")); |
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
class XMLTreeModel implements TreeModel { | |
private Element root; | |
public XMLTreeModel(Element e) { | |
root = e; | |
} | |
public Vector getChildren(Object parent) { | |
if(parent == null) { | |
Vector c = new Vector(); | |
c.addElement(root); |
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
class StringArrayTreeModel implements TreeModel { | |
String[][] arr = new String[][] { | |
{"Colors", "Letters", "Numbers"}, | |
{"Red", "Green", "Blue"}, | |
{"A", "B", "C"}, | |
{"1", "2", "3"} | |
}; | |
public Vector getChildren(Object parent) { | |
if(parent == null) { |
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("Table", new BorderLayout()); | |
TableModel model = new DefaultTableModel(new String[] {"Col 1", "Col 2", "Col 3"}, new Object[][] { | |
{"Row 1", "Row A", "Row X"}, | |
{"Row 2", "Row B can now stretch", null}, | |
{"Row 3", "Row C", "Row Z"}, | |
{"Row 4", "Row D", "Row K"}, | |
}) { | |
public boolean isCellEditable(int row, int col) { | |
return col != 0; | |
} |
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("MultiList", new BorderLayout()); | |
int mm = Display.getInstance().convertToPixels(3); | |
EncodedImage placeholder = EncodedImage.createFromImage(Image.createImage(mm * 3, mm * 4, 0), false); | |
Image icon1 = URLImage.createToStorage(placeholder, "icon1", "http://www.georgerrmartin.com/wp-content/uploads/2013/03/GOTMTI2.jpg"); | |
Image icon2 = URLImage.createToStorage(placeholder, "icon2", "http://www.georgerrmartin.com/wp-content/uploads/2012/08/clashofkings.jpg"); | |
Image icon3 = URLImage.createToStorage(placeholder, "icon3", "http://www.georgerrmartin.com/wp-content/uploads/2013/03/stormswordsMTI.jpg"); | |
Image icon4 = URLImage.createToStorage(placeholder, "icon4", "http://www.georgerrmartin.com/wp-content/uploads/2012/08/feastforcrows.jpg"); | |
Image icon5 = URLImage.createToStorage(placeholder, "icon5", "http://georgerrmartin.com/gallery/art/dragons05.jpg"); |
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
class GRMMModel implements ListModel<Map<String,Object>> { | |
@Override | |
public Map<String, Object> getItemAt(int index) { | |
int idx = index % 7; | |
switch(idx) { | |
case 0: | |
return createListEntry("A Game of Thrones " + index, "1996"); | |
case 1: | |
return createListEntry("A Clash Of Kings " + index, "1998"); | |
case 2: |
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
class MyYesNoRenderer extends Label implements ListCellRenderer { | |
Label label = new Label(" "); | |
public Component getListCellRendererComponent(List list, Object value, int index, boolean isSelected) { | |
if( ((Boolean)value).booleanValue() ) { | |
setText("Yes"); | |
} else { | |
setText("No"); | |
} | |
return this; | |
} |