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
| Button button; | |
| hi.setLayout(new GridBagLayout()); | |
| GridBagConstraints c = new GridBagConstraints(); | |
| //natural height, maximum width | |
| c.fill = GridBagConstraints.HORIZONTAL; | |
| button = new Button("Button 1"); | |
| c.weightx = 0.5; | |
| c.fill = GridBagConstraints.HORIZONTAL; |
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 test = new Form("Complete"); | |
| test.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); | |
| AutoCompleteTextField at = new AutoCompleteTextField(new String[] {"Common", "Code", "Codename One", "Correct", "Correlation", "Co-location", "Corporate"} ); | |
| test.addComponent(at); | |
| test.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
| final Form test = new Form("Infinite"); | |
| test.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); | |
| InfiniteScrollAdapter.createInfiniteScroll(test.getContentPane(), new Runnable() { | |
| private int counter = 1; | |
| public void run() { | |
| // simulate network latency | |
| Display.getInstance().invokeAndBlock(new Runnable() { | |
| public void run() { | |
| try { |
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.mycompany.myapp; | |
| import com.codename1.ui.Command; | |
| import com.codename1.ui.Display; | |
| import com.codename1.ui.Form; | |
| import com.codename1.ui.SideMenuBar; | |
| import com.codename1.ui.events.ActionEvent; | |
| import com.codename1.ui.plaf.UIManager; | |
| import com.codename1.ui.util.Resources; |
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
| Component customCmp = ...; | |
| Command cmd = ...; | |
| cmd.putClientProperty("SideComponent", customCmp); |
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
| Button b = ((GenericListCellRenderer)list.getRenderer()).extractLastClickedComponent(); | |
| if(b != null && "X".equals(b.getName())) { | |
| // handle button click event and return | |
| return; | |
| } | |
| // handle standard list action event |
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
| x.addActionListener(new ActionListener() { | |
| public void actionPerformed(ActionEvent ev) { | |
| // notice we do nothing, this is an event on a stateless component of the renderer | |
| xWasClicked = true; | |
| } | |
| }); | |
| list.addActionListener(new ActionListener() { | |
| public void actionPerformed(ActionEvent ev) { | |
| if(xWasClicked) { |
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 class MyApplication { | |
| private Form current; | |
| public void init(Object context) { | |
| try { | |
| Resources theme = Resources.openLayered("/theme"); | |
| UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); | |
| } catch(IOException e){ | |
| e.printStackTrace(); |
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
| ios.objC=true | |
| android.xapplication=<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="YOUR_ANDROID_API_KEY"/> | |
| ios.add_libs=libc++.dylib;libicucore.dylib;libz.dylib;CoreData.framework;CoreText.framework;GLKit.framework;ImageIO.framework;SystemConfiguration.framework | |
| ios.glAppDelegateHeader=#import "GoogleMaps.h" | |
| android.includeGPlayServices=true | |
| ios.afterFinishLaunching=[GMSServices provideAPIKey:@"YOUR_IOS_API_KEY"]; | |
| android.xpermissions=<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/><uses-feature android:glEsVersion="0x00020000" android:required="true"/> |
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
| import com.codename1.googlemaps.MapContainer; | |
| import com.codename1.maps.Coord; | |
| import com.codename1.ui.Command; | |
| import com.codename1.ui.Dialog; | |
| import com.codename1.ui.Display; | |
| import com.codename1.ui.EncodedImage; | |
| import com.codename1.ui.Form; | |
| import com.codename1.ui.events.ActionEvent; | |
| import com.codename1.ui.events.ActionListener; | |
| import com.codename1.ui.layouts.BorderLayout; |
OlderNewer