本文整理汇总了Java中com.codename1.ui.Form.show方法的典型用法代码示例。如果您正苦于以下问题:Java Form.show方法的具体用法?Java Form.show怎么用?Java Form.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.codename1.ui.Form
的用法示例。
在下文中一共展示了Form.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import com.codename1.ui.Form; //导入方法依赖的package包/类
public void start() {
if(current != null){
current.show();
return;
}
Form hi = new Form("Hi World", BoxLayout.y());
hi.add(new Label("Hi World"));
hi.show();
if (System.currentTimeMillis() < 100) {
QRScanner.scanQRCode(new ScanResult() {
public void scanCompleted(String contents, String formatName, byte[] rawBytes) {
Dialog.show("Completed", contents, "OK", null);
}
public void scanCanceled() {
Dialog.show("Cancelled", "Scan Cancelled", "OK", null);
}
public void scanError(int errorCode, String message) {
Dialog.show("Error", message, "OK", null);
}
});
}
}
示例2: showMainForm
import com.codename1.ui.Form; //导入方法依赖的package包/类
private void showMainForm() {
final Form photos = new Form("Photos");
photos.setLayout(new BorderLayout());
GridLayout gr = new GridLayout(1, 1);
final Container grid = new Container(gr);
gr.setAutoFit(true);
grid.setScrollableY(true);
grid.addPullToRefresh(new Runnable() {
public void run() {
refreshGrid(grid);
}
});
grid.addComponent(new InfiniteProgress());
photos.addComponent(BorderLayout.CENTER, grid);
photos.removeAllCommands();
photos.setBackCommand(null);
photos.addCommand(createPictureCommand(grid));
photos.show();
refreshGrid(grid);
}
示例3: start
import com.codename1.ui.Form; //导入方法依赖的package包/类
public void start() {
if(current != null){
current.show();
return;
}
Form hi = new Form("Signature Component");
hi.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
hi.add("Enter Your Name:");
hi.add(new TextField());
hi.add("Signature:");
SignatureComponent sig = new SignatureComponent();
sig.addActionListener((evt)-> {
System.out.println("The signature was changed");
Image img = sig.getSignatureImage();
// Now we can do whatever we want with the image of this signature.
});
hi.addComponent(sig);
hi.show();
}
示例4: start
import com.codename1.ui.Form; //导入方法依赖的package包/类
public void start() {
if(current != null){
current.show();
return;
}
placeholder = EncodedImage.createFromImage(Image.createImage(53, 81, 0), false);
Form react = new Form("React Demo", new BorderLayout());
react.add(BorderLayout.CENTER, new InfiniteContainer() {
public Component[] fetchComponents(int index, int amount) {
try {
Collection data = (Collection)ConnectionRequest.fetchJSON(REQUEST_URL).get("movies");
Component[] response = new Component[data.size()];
int offset = 0;
for(Object movie : data) {
response[offset] = createMovieEntry(Result.fromContent((Map)movie));
offset++;
}
return response;
} catch(IOException err) {
Dialog.show("Error", "Error during connection: " + err, "OK", null);
}
return null;
}
});
react.show();
}
示例5: showFacebookUser
import com.codename1.ui.Form; //导入方法依赖的package包/类
private void showFacebookUser(String token){
ConnectionRequest req = new ConnectionRequest();
req.setPost(false);
req.setUrl("https://graph.facebook.com/v2.3/me");
req.addArgumentNoEncoding("access_token", token);
InfiniteProgress ip = new InfiniteProgress();
Dialog d = ip.showInifiniteBlocking();
NetworkManager.getInstance().addToQueueAndWait(req);
byte[] data = req.getResponseData();
JSONParser parser = new JSONParser();
Map map = null;
try {
map = parser.parseJSON(new InputStreamReader(new ByteArrayInputStream(data), "UTF-8"));
} catch (IOException ex) {
ex.printStackTrace();
}
String name = (String) map.get("name");
d.dispose();
Form userForm = new UserForm(name, (EncodedImage) theme.getImage("user.png"), "https://graph.facebook.com/v2.3/me/picture?access_token=" + token);
userForm.show();
}
示例6: showGoogleUser
import com.codename1.ui.Form; //导入方法依赖的package包/类
private void showGoogleUser(String token){
ConnectionRequest req = new ConnectionRequest();
req.addRequestHeader("Authorization", "Bearer " + token);
req.setUrl("https://www.googleapis.com/plus/v1/people/me");
req.setPost(false);
InfiniteProgress ip = new InfiniteProgress();
Dialog d = ip.showInifiniteBlocking();
NetworkManager.getInstance().addToQueueAndWait(req);
d.dispose();
byte[] data = req.getResponseData();
JSONParser parser = new JSONParser();
Map map = null;
try {
map = parser.parseJSON(new InputStreamReader(new ByteArrayInputStream(data), "UTF-8"));
} catch (IOException ex) {
ex.printStackTrace();
}
String name = (String) map.get("displayName");
Map im = (Map) map.get("image");
String url = (String) im.get("url");
Form userForm = new UserForm(name, (EncodedImage) theme.getImage("user.png"), url);
userForm.show();
}
示例7: showLog
import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
* Places a form with the log as a TextArea on the screen, this method can
* be attached to appear at a given time or using a fixed global key. Using
* this method might cause a problem with further log output
* @deprecated this method is an outdated method that's no longer supported
*/
public static void showLog() {
try {
String text = getLogContent();
TextArea area = new TextArea(text, 5, 20);
Form f = new Form("Log");
f.setScrollable(false);
final Form current = Display.getInstance().getCurrent();
Command back = new Command("Back") {
public void actionPerformed(ActionEvent ev) {
current.show();
}
};
f.addCommand(back);
f.setBackCommand(back);
f.setLayout(new BorderLayout());
f.addComponent(BorderLayout.CENTER, area);
f.show();
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例8: run
import com.codename1.ui.Form; //导入方法依赖的package包/类
public void run() {
if(currentAction != null) {
if(Display.getInstance().isEdt()) {
postAsyncCommand(currentAction, currentActionEvent);
} else {
asyncCommandProcess(currentAction, currentActionEvent);
// wait for the destination form to appear before moving back into the Codename One thread
waitForForm(destForm);
}
} else {
if(Display.getInstance().isEdt()) {
if(Display.getInstance().getCurrent() != null) {
exitForm(Display.getInstance().getCurrent());
}
Form f = (Form)createContainer(fetchResourceFile(), nextForm);
beforeShow(f);
f.show();
postShowImpl(f);
} else {
if(processBackground(destForm)) {
waitForForm(destForm);
}
}
}
}
示例9: showFavs
import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
* Shows the favorites screen
*/
void showFavs() {
final Form favsForm = new Form("Favourites");
addBackToHome(favsForm);
favsForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
if(favoritesList.size() == 0) {
favsForm.addComponent(new SpanLabel("You have not added any properties to your favourites"));
} else {
// this is really trivial we just take the favorites and show them as a set of buttons
for(Map<String, Object> c : favoritesList) {
MultiButton mb = new MultiButton();
final Map<String, Object> currentListing = c;
String thumb_url = (String)currentListing.get("thumb_url");
String guid = (String)currentListing.get("guid");
String price_formatted = (String)currentListing.get("price_formatted");
String summary = (String)currentListing.get("summary");
mb.setIcon(URLImage.createToStorage(placeholder, guid, thumb_url, URLImage.RESIZE_SCALE_TO_FILL));
mb.setTextLine1(price_formatted);
mb.setTextLine2(summary);
mb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
showPropertyDetails(favsForm, currentListing);
}
});
favsForm.addComponent(mb);
}
}
favsForm.show();
}
示例10: start
import com.codename1.ui.Form; //导入方法依赖的package包/类
public void start() {
if (current != null) {
current.show();
return;
}
Form main = createMainForm();
main.show();
}
示例11: start
import com.codename1.ui.Form; //导入方法依赖的package包/类
public void start() {
if(current != null){
current.show();
return;
}
Form hi = new Form("Clock Demo");
AnalogClock clock = new AnalogClock();
hi.setLayout(new BorderLayout());
hi.addComponent(BorderLayout.CENTER, clock);
clock.start();
hi.show();
}
示例12: showLoginForm
import com.codename1.ui.Form; //导入方法依赖的package包/类
private void showLoginForm() {
Form login = new Form("Login");
BorderLayout bl = new BorderLayout();
bl.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
ComponentGroup loginDetails = new ComponentGroup();
TextField displayName = new TextField();
displayName.setHint("Display Name");
loginDetails.addComponent(displayName);
final TextField email = new TextField();
email.setHint("E-Mail");
loginDetails.addComponent(email);
Button send = new Button("Send Verification");
loginDetails.addComponent(send);
send.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
onSendAction(email);
}
});
login.setLayout(bl);
login.addComponent(BorderLayout.CENTER, loginDetails);
login.show();
}
示例13: showMeOnMap
import com.codename1.ui.Form; //导入方法依赖的package包/类
private void showMeOnMap() {
Form map = new Form("Map");
map.setLayout(new BorderLayout());
map.setScrollable(false);
final MapComponent mc = new MapComponent();
putMeOnMap(mc);
mc.zoomToLayers();
map.addComponent(BorderLayout.CENTER, mc);
map.getToolbar().addCommandToLeftBar(new MapsDemo.BackCommand());
map.setBackCommand(new MapsDemo.BackCommand());
map.show();
}
示例14: play
import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
* Start media playback implicitly setting the component to visible
*/
public void play() {
if(nativePlayer && curentForm == null){
curentForm = Display.getInstance().getCurrent();
Form f = new Form();
f.setLayout(new BorderLayout());
f.addComponent(BorderLayout.CENTER, new MediaPlayer(this));
f.show();
}
player.play();
}
示例15: startBackTransition
import com.codename1.ui.Form; //导入方法依赖的package包/类
void startBackTransition(final Form currentForm, Form destination) {
final Transition t = destination.getTransitionOutAnimator().copy(true);
if(t instanceof CommonTransitions) {
Transition originalTransition = currentForm.getTransitionOutAnimator();
currentForm.setTransitionOutAnimator(CommonTransitions.createEmpty());
Form blank = new Form() {
protected boolean shouldSendPointerReleaseToOtherForm() {
return true;
}
};
blank.addPointerDraggedListener(pointerDragged);
blank.addPointerReleasedListener(pointerReleased);
blank.addPointerPressedListener(pointerPressed);
blank.setTransitionInAnimator(CommonTransitions.createEmpty());
blank.setTransitionOutAnimator(CommonTransitions.createEmpty());
blank.show();
currentForm.setTransitionOutAnimator(originalTransition);
((CommonTransitions)t).setMotion(new LazyValue<Motion>() {
public Motion get(Object... args) {
return new ManualMotion(((Integer)args[0]).intValue(), ((Integer)args[1]).intValue(), ((Integer)args[2]).intValue());
}
});
t.init(currentForm, destination);
t.initTransition();
blank.setGlassPane(new Painter() {
public void paint(Graphics g, Rectangle rect) {
t.animate();
t.paint(g);
}
});
}
}