本文整理汇总了Java中com.codename1.ui.Label.setUIID方法的典型用法代码示例。如果您正苦于以下问题:Java Label.setUIID方法的具体用法?Java Label.setUIID怎么用?Java Label.setUIID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.codename1.ui.Label
的用法示例。
在下文中一共展示了Label.setUIID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import com.codename1.ui.Label; //导入方法依赖的package包/类
public static void show(String text, final Form f)
{
isVisible = true;
f.getLayeredPane().setLayout(new BorderLayout());
final Label l = new Label(text);
l.setUIID("ToastMessage");
f.getLayeredPane().addComponent(BorderLayout.SOUTH, l);
f.repaint();
Timer exitTimer = new Timer();
exitTimer.schedule(new TimerTask() {
@Override
public void run() {
f.getLayeredPane().removeAll();
f.repaint();
isVisible = false;
}
}, toastTimeOut);
}
示例2: wrapInShelves
import com.codename1.ui.Label; //导入方法依赖的package包/类
/**
* This method wraps the layout in a way so the shelves are rendered underneath the
* given component
*/
private Container wrapInShelves(Container c) {
Container layered = new Container(new LayeredLayout());
Container sides = new Container(new BorderLayout());
Label right = new Label(" ");
right.setUIID("Right");
sides.addComponent(BorderLayout.EAST, right);
Label left = new Label(" ");
left.setUIID("Left");
sides.addComponent(BorderLayout.WEST, left);
layered.addComponent(sides);
layered.addComponent(c);
return layered;
}
示例3: createRendererContainer
import com.codename1.ui.Label; //导入方法依赖的package包/类
private Container createRendererContainer() {
Container entries = new Container(new BoxLayout(BoxLayout.Y_AXIS));
entries.setUIID("RSSEntry");
Label title = new Label();
title.setName("title");
title.setUIID("RSSTitle");
entries.addComponent(title);
TextArea description = new TextArea(2, 30);
description.setGrowByContent(false);
description.setName("details");
description.setUIID("RSSDescription");
description.setScrollVisible(false);
entries.addComponent(description);
if(iconPlaceholder != null) {
Container wrap = new Container(new BorderLayout());
wrap.addComponent(BorderLayout.CENTER, entries);
Label icon = new Label();
icon.setIcon(iconPlaceholder);
icon.setUIID("RSSIcon");
icon.setName("icon");
wrap.addComponent(BorderLayout.WEST, icon);
entries = wrap;
}
return entries;
}
示例4: createMorphEffect
import com.codename1.ui.Label; //导入方法依赖的package包/类
private void createMorphEffect(Label titleLabel) {
// animate the components out of the previous form if we are coming in from the login form
Form parent = Display.getInstance().getCurrent();
if(parent.getUIID().equals("MainForm")) {
for(Component cmp : parent.getContentPane()) {
cmp.setX(parent.getWidth());
}
// moves all the components outside of the content pane to the right while fading them out over 400ms
parent.getContentPane().animateUnlayoutAndWait(400, 0);
parent.getContentPane().removeAll();
// we can't mutate a form into a component in another form so we need to convert the background to an image and then morph that
// this is especially easy since we already removed all the components
Label dummy = new Label();
dummy.setShowEvenIfBlank(true);
dummy.setUIID("Container");
dummy.setUnselectedStyle(new Style(parent.getUnselectedStyle()));
parent.setUIID("Form");
// special case to remove status bar on iOS 7
parent.getTitleArea().removeAll();
parent.setLayout(new BorderLayout());
parent.addComponent(BorderLayout.CENTER, dummy);
parent.revalidate();
// animate the main panel to the new location at the top title area of the screen
dummy.setName("fullScreen");
titleLabel.setName("titleImage");
parent.setTransitionOutAnimator(MorphTransition.create(1100).morph("fullScreen", "titleImage"));
}
}
示例5: UserForm
import com.codename1.ui.Label; //导入方法依赖的package包/类
public UserForm(String name, EncodedImage placeHolder, String imageURL) {
this.name = name;
this.imageURL = imageURL;
setTitle("Welcome!");
setLayout(new BorderLayout());
Label icon = new Label(placeHolder);
icon.setUIID("Picture");
if(imageURL != null){
icon.setIcon(URLImage.createToStorage(placeHolder, name, imageURL, null));
}
addComponent(BorderLayout.CENTER, icon);
Label nameLbl = new Label(name);
nameLbl.setUIID("Name");
addComponent(BorderLayout.SOUTH, nameLbl);
final Form current = Display.getInstance().getCurrent();
Command back = new Command("Back"){
@Override
public void actionPerformed(ActionEvent evt) {
current.showBack();;
}
};
addCommand(back);
setBackCommand(back);
}
示例6: createSeparator
import com.codename1.ui.Label; //导入方法依赖的package包/类
Component createSeparator() {
Label l = new Label(" ") {
public void repaint() {
getParent().repaint();
}
};
l.setUIID("SpinnerSeparator");
return l;
}
示例7: SpanLabel
import com.codename1.ui.Label; //导入方法依赖的package包/类
/**
* Constructor accepting default text
*/
public SpanLabel(String txt) {
setUIID("Container");
setLayout(new BorderLayout());
text = new TextArea(getUIManager().localize(txt, txt));
text.setActAsLabel(true);
text.setColumns(text.getText().length() + 1);
text.setUIID("Label");
text.setEditable(false);
text.setFocusable(false);
icon = new Label();
icon.setUIID("icon");
addComponent(BorderLayout.WEST, icon);
addComponent(BorderLayout.CENTER, text);
}
示例8: createPopupContent
import com.codename1.ui.Label; //导入方法依赖的package包/类
/**
* Creates the popup content container to display on the dialog.
*
* @param fabs List of sub FloatingActionButton
* @return a Container that contains all fabs
*/
protected Container createPopupContent(List<FloatingActionButton> fabs) {
Container con = new Container(new BoxLayout(BoxLayout.Y_AXIS));
for (FloatingActionButton next : subMenu) {
next.setPreferredW(getWidth());
Container c = new Container(new BorderLayout());
Label txt = new Label(next.text);
txt.setUIID("FloatingActionText");
c.add(BorderLayout.CENTER, FlowLayout.encloseRight(txt));
c.add(BorderLayout.EAST, next);
con.add(c);
}
return con;
}
示例9: SpanLabel
import com.codename1.ui.Label; //导入方法依赖的package包/类
/**
* Constructor accepting default text
*/
public SpanLabel(String txt) {
setUIID("Container");
setLayout(new BorderLayout());
text = new TextArea(getUIManager().localize(txt, txt));
text.setUIID("Label");
text.setEditable(false);
text.setFocusable(false);
icon = new Label();
icon.setUIID("icon");
addComponent(BorderLayout.WEST, icon);
addComponent(BorderLayout.CENTER, text);
}
示例10: createTitleComponent
import com.codename1.ui.Label; //导入方法依赖的package包/类
/**
* Creates the title area that allows searching and "peeking" of the user avatar from the title area
* @return the title component
*/
private Component createTitleComponent(Form parent) {
// we want the toolbar to be completely transparent, since we created it on the layered pane (using the true
// argument in the constructor) it will flow in the UI
parent.getToolbar().setUIID("Container");
// we create 3 layers within the title, the region contains all the layers, the encspsulate includes the "me image"
// which we want to protrude under the title area layer
Container titleRegion = new Container(new LayeredLayout());
Container titleEncapsulate = new Container(new BorderLayout());
Container titleArea = new Container(new BorderLayout());
// since the Toolbar is now transparent we assign the title area UIID to one of the layers within and the look
// is preserved, we make it translucent though so we can see what's underneath
titleArea.setUIID("TitleArea");
titleArea.getUnselectedStyle().setBgTransparency(128);
// We customize the title completely using a component, the "title" is just a label with the Title UIID
Label title = new Label(parent.getTitle());
title.setUIID("Title");
titleArea.addComponent(BorderLayout.CENTER, title);
// the search button allows us to search a large list of contacts rather easily
Button search = createSearchButton(parent, title, titleArea, titleRegion);
// we package everything in a container so we can replace the title area with a search button as needed
Container cnt = new Container(new BoxLayout(BoxLayout.X_AXIS));
titleArea.addComponent(BorderLayout.EAST, cnt);
cnt.addComponent(search);
// this is the Me picture that protrudes downwards. We use a placeholder which is then replace by the URLImage
// with the actual image. Notice that createMaskAdapter allows us to not just scale the image but also apply
// a mask to it...
roundedMeImage = URLImage.createToStorage(roundPlaceholder, "userImage", imageURL, URLImage.createMaskAdapter(mask));
Label me = new Label(roundedMeImage);
me.setUIID("UserImage");
// the search icon and the "me" image are on two separate layers so we use a "dummy" component that we
// place in the search container to space it to the side and leave room for the "me" image
Label spacer = new Label(" ");
Container.setSameWidth(spacer, me);
cnt.addComponent(spacer);
Container iconLayer = new Container(new BorderLayout());
titleEncapsulate.addComponent(BorderLayout.NORTH, titleArea);
titleRegion.addComponent(titleEncapsulate);
titleRegion.addComponent(iconLayer);
iconLayer.addComponent(BorderLayout.EAST, me);
return titleRegion;
}
示例11: createEntry
import com.codename1.ui.Label; //导入方法依赖的package包/类
/**
* This method builds a UI Entry dynamically from a data Map object.
*/
private static Component createEntry(Map data, final int index) {
final Container cnt = new Container(new BorderLayout());
cnt.setUIID("MultiButton");
Button icon = new Button();
icon.setUIID("Label");
//take the time and use it as the identifier of the image
String time = (String) data.get("date_taken");
String link = (String) ((Map) data.get("media")).get("m");
EncodedImage im = (EncodedImage) res.getImage("flickr.png");
final URLImage image = URLImage.createToStorage(im, time, link, null);
icon.setIcon(image);
icon.setName("ImageButton" + index);
icon.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Dialog d = new Dialog();
//d.setDialogUIID("Container");
d.setLayout(new BorderLayout());
Label l = new Label(image);
l.setUIID("ImagePop");
d.add(BorderLayout.CENTER, l);
d.setDisposeWhenPointerOutOfBounds(true);
d.setTransitionInAnimator(new BubbleTransition(300, "ImageButton" + index));
d.setTransitionOutAnimator(new BubbleTransition(300, "ImageButton" + index));
d.show();
}
});
cnt.addComponent(BorderLayout.WEST, icon);
Container center = new Container(new BorderLayout());
Label des = new Label((String) data.get("title"));
des.setUIID("MultiLine1");
center.addComponent(BorderLayout.NORTH, des);
Label author = new Label((String) data.get("author"));
author.setUIID("MultiLine2");
center.addComponent(BorderLayout.SOUTH, author);
cnt.addComponent(BorderLayout.CENTER, center);
return cnt;
}
示例12: showSplashScreen
import com.codename1.ui.Label; //导入方法依赖的package包/类
/**
* The splash screen is relatively bare bones. Its important to have a splash screen for iOS
* since the build process generates a screenshot of this screen to speed up perceived performance
*/
public void showSplashScreen() {
final Form splash = new Form();
// a border layout places components in the center and the 4 sides.
// by default it scales the center component so here we configure
// it to place the component in the actual center
BorderLayout border = new BorderLayout();
border.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
splash.setLayout(border);
// by default the form's content pane is scrollable on the Y axis
// we need to disable it here
splash.setScrollable(false);
Label title = new Label("Poker Ace");
// The UIID is used to determine the appearance of the component in the theme
title.setUIID("SplashTitle");
Label subtitle = new Label("By Codename One");
subtitle.setUIID("SplashSubTitle");
splash.addComponent(BorderLayout.NORTH, title);
splash.addComponent(BorderLayout.SOUTH, subtitle);
Label as = new Label(cards.getImage("as.png"));
Label ah = new Label(cards.getImage("ah.png"));
Label ac = new Label(cards.getImage("ac.png"));
Label ad = new Label(cards.getImage("ad.png"));
// a layered layout places components one on top of the other in the same dimension, it is
// useful for transparency but in this case we are using it for an animation
final Container center = new Container(new LayeredLayout());
center.addComponent(as);
center.addComponent(ah);
center.addComponent(ac);
center.addComponent(ad);
splash.addComponent(BorderLayout.CENTER, center);
splash.show();
splash.setTransitionOutAnimator(CommonTransitions.createCover(CommonTransitions.SLIDE_VERTICAL, true, 800));
// postpone the animation to the next cycle of the EDT to allow the UI to render fully once
Display.getInstance().callSerially(new Runnable() {
public void run() {
// We replace the layout so the cards will be laid out in a line and animate the hierarchy
// over 2 seconds, this effectively creates the effect of cards spreading out
center.setLayout(new BoxLayout(BoxLayout.X_AXIS));
center.setShouldCalcPreferredSize(true);
splash.getContentPane().animateHierarchy(2000);
// after showing the animation we wait for 2.5 seconds and then show the game with a nice
// transition, notice that we use UI timer which is invoked on the Codename One EDT thread!
new UITimer(new Runnable() {
public void run() {
showGameUI();
}
}).schedule(2500, false, splash);
}
});
}
示例13: showSplashAnimation
import com.codename1.ui.Label; //导入方法依赖的package包/类
private void showSplashAnimation() {
Form splash = new Form();
splash.setUIID("Splash");
splash.getContentPane().setUIID("Container");
splash.getTitleArea().setUIID("Container");
BorderLayout border = new BorderLayout();
border.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
splash.setLayout(border);
splash.setScrollable(false);
Label title = new Label("Kitchen Sink Demo");
title.setUIID("SplashTitle");
Label subtitle = new Label("By Codename One");
subtitle.setUIID("SplashSubTitle");
splash.addComponent(BorderLayout.NORTH, title);
splash.addComponent(BorderLayout.SOUTH, subtitle);
Label beaker = new Label(res.getImage("beaker.png"));
final Label beakerLogo = new Label(res.getImage("beaker_logo.png"));
beakerLogo.setVisible(false);
Container layeredLayout = new Container(new LayeredLayout());
splash.addComponent(BorderLayout.CENTER, layeredLayout);
layeredLayout.addComponent(beaker);
final Container logoParent = new Container(new BorderLayout());
layeredLayout.addComponent(logoParent);
logoParent.addComponent(BorderLayout.CENTER, beakerLogo);
splash.revalidate();
Display.getInstance().callSerially(new Runnable() {
public void run() {
beakerLogo.setVisible(true);
beakerLogo.setX(0);
beakerLogo.setY(0);
beakerLogo.setWidth(3);
beakerLogo.setHeight(3);
logoParent.setShouldCalcPreferredSize(true);
logoParent.animateLayoutFade(2000, 0);
}
});
splash.show();
splash.setTransitionOutAnimator(CommonTransitions.createFastSlide(CommonTransitions.SLIDE_VERTICAL, true, 300));
new UITimer(new Runnable() {
public void run() {
showMainUI();
}
}).schedule(2500, false, splash);
}
示例14: bindTabletLandscapeMaster
import com.codename1.ui.Label; //导入方法依赖的package包/类
/**
* @deprecated this was a half baked idea that made it into the public API
*/
public static void bindTabletLandscapeMaster(final Form rootForm, Container parentContainer, Component landscapeUI, final Component portraitUI, final String commandTitle, Image commandIcon) {
landscapeUI.setHideInPortrait(true);
parentContainer.addComponent(BorderLayout.WEST, landscapeUI);
final Command masterCommand = new Command(commandTitle, commandIcon) {
public void actionPerformed(ActionEvent ev) {
Dialog dlg = new Dialog();
dlg.setLayout(new BorderLayout());
dlg.setDialogUIID("Container");
dlg.getContentPane().setUIID("Container");
Container titleArea = new Container(new BorderLayout());
dlg.addComponent(BorderLayout.NORTH, titleArea);
titleArea.setUIID("TitleArea");
Label title = new Label(commandTitle);
titleArea.addComponent(BorderLayout.CENTER, title);
title.setUIID("Title");
Container body = new Container(new BorderLayout());
body.setUIID("Form");
body.addComponent(BorderLayout.CENTER, portraitUI);
dlg.setTransitionInAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_HORIZONTAL, false, 250));
dlg.setTransitionOutAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_HORIZONTAL, true, 250));
dlg.addComponent(BorderLayout.CENTER, body);
dlg.setDisposeWhenPointerOutOfBounds(true);
dlg.showStetched(BorderLayout.WEST, true);
dlg.removeComponent(portraitUI);
}
};
if(Display.getInstance().isPortrait()) {
if(rootForm.getCommandCount() > 0) {
rootForm.addCommand(masterCommand, 1);
} else {
rootForm.addCommand(masterCommand);
}
}
rootForm.addOrientationListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if(portraitUI.getParent() != null) {
Form f = Display.getInstance().getCurrent();
if(f instanceof Dialog) {
((Dialog)f).dispose();
}
}
if(Display.getInstance().isPortrait()) {
rootForm.addCommand(masterCommand, 1);
} else {
rootForm.removeCommand(masterCommand);
rootForm.revalidate();
}
}
});
}
示例15: showSplashAnimation
import com.codename1.ui.Label; //导入方法依赖的package包/类
private void showSplashAnimation() {
Form splash = new Form();
splash.setUIID("Splash");
splash.getContentPane().setUIID("Container");
splash.getTitleArea().setUIID("Container");
BorderLayout border = new BorderLayout();
border.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
splash.setLayout(border);
splash.setScrollable(false);
Label title = new Label("Kitchen Sink Demo");
title.setUIID("SplashTitle");
Label subtitle = new Label("By Codename One");
subtitle.setUIID("SplashSubTitle");
splash.addComponent(BorderLayout.NORTH, title);
splash.addComponent(BorderLayout.SOUTH, subtitle);
Label beaker = new Label(res.getImage("beaker.png"));
final Label beakerLogo = new Label(res.getImage("beaker_logo.png"));
beakerLogo.setVisible(false);
Container layeredLayout = new Container(new LayeredLayout());
splash.addComponent(BorderLayout.CENTER, layeredLayout);
layeredLayout.addComponent(beaker);
final Container logoParent = new Container(new BorderLayout());
layeredLayout.addComponent(logoParent);
logoParent.addComponent(BorderLayout.CENTER, beakerLogo);
splash.revalidate();
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
beakerLogo.setVisible(true);
beakerLogo.setX(0);
beakerLogo.setY(0);
beakerLogo.setWidth(3);
beakerLogo.setHeight(3);
logoParent.setShouldCalcPreferredSize(true);
logoParent.animateLayoutFade(2000, 0);
}
});
splash.show();
splash.setTransitionOutAnimator(CommonTransitions.createFastSlide(CommonTransitions.SLIDE_VERTICAL, true, 300));
new UITimer(new Runnable() {
public void run() {
showMainUI();
}
}).schedule(2500, false, splash);
}