本文整理汇总了Java中com.codename1.ui.Button.setUIID方法的典型用法代码示例。如果您正苦于以下问题:Java Button.setUIID方法的具体用法?Java Button.setUIID怎么用?Java Button.setUIID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.codename1.ui.Button
的用法示例。
在下文中一共展示了Button.setUIID方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createToolbar
import com.codename1.ui.Button; //导入方法依赖的package包/类
Container createToolbar(long imageId) {
Container toolbar = new Container(new GridLayout(1, 4));
toolbar.setUIID("Toolbar");
// notice that the characters in the name of the buttons map to icons in the icon font!
Button likeButton = new Button("d");
Button flagButton = new Button("c");
Button detailsButton = new Button("a");
final ShareButton shareButton = new ShareButton();
shareButton.setIcon(null);
shareButton.setText("b");
bindShareButtonSelectionListener(shareButton);
likeButton.setUIID("ToolbarLabel");
flagButton.setUIID("ToolbarLabel");
detailsButton.setUIID("ToolbarLabel");
shareButton.setUIID("ToolbarLabel");
toolbar.addComponent(likeButton);
toolbar.addComponent(shareButton);
toolbar.addComponent(detailsButton);
toolbar.addComponent(flagButton);
likeButton.addActionListener(createLikeAction(imageId));
detailsButton.addActionListener(createDetailsButtonActionListener(imageId));
return toolbar;
}
示例2: createNodeComponent
import com.codename1.ui.Button; //导入方法依赖的package包/类
/**
* Creates a node within the tree, this method is protected allowing tree to be
* subclassed to replace the rendering logic of individual tree buttons.
*
* @param node the node object from the model to display on the button
* @param depth the depth within the tree (normally represented by indenting the entry)
* @return a button representing the node within the tree
* @deprecated replaced with createNode, bindNodeListener and setNodeIcon
*/
protected Button createNodeComponent(Object node, int depth) {
Button cmp = new Button(childToDisplayLabel(node));
cmp.setUIID("TreeNode");
if(model.isLeaf(node)) {
if(nodeImage == null) {
FontImage.setMaterialIcon(cmp, FontImage.MATERIAL_DESCRIPTION, 3);
} else {
cmp.setIcon(nodeImage);
}
} else {
if(folder == null) {
FontImage.setMaterialIcon(cmp, FontImage.MATERIAL_FOLDER, 3);
} else {
cmp.setIcon(folder);
}
}
updateNodeComponentStyle(cmp.getSelectedStyle(), depth);
updateNodeComponentStyle(cmp.getUnselectedStyle(), depth);
updateNodeComponentStyle(cmp.getPressedStyle(), depth);
return cmp;
}
示例3: SpanButton
import com.codename1.ui.Button; //导入方法依赖的package包/类
/**
* Constructor accepting default text
*/
public SpanButton(String txt) {
setUIID("Button");
setLayout(new BorderLayout());
text = new TextArea(getUIManager().localize(txt, txt));
text.setColumns(100);
text.setUIID("Button");
text.setEditable(false);
text.setFocusable(false);
text.setActAsLabel(true);
removeBackground(text.getUnselectedStyle());
removeBackground(text.getSelectedStyle());
removeBackground(text.getPressedStyle());
removeBackground(text.getDisabledStyle());
actualButton = new Button();
actualButton.setUIID("icon");
addComponent(BorderLayout.WEST, actualButton);
addComponent(BorderLayout.CENTER, text);
setLeadComponent(actualButton);
}
示例4: SpanButton
import com.codename1.ui.Button; //导入方法依赖的package包/类
/**
* Constructor accepting default text
*/
public SpanButton(String txt) {
setUIID("Button");
setLayout(new BorderLayout());
text = new TextArea(getUIManager().localize(txt, txt));
text.setColumns(100);
text.setUIID("Button");
text.setEditable(false);
text.setFocusable(false);
removeBackground(text.getUnselectedStyle());
removeBackground(text.getSelectedStyle());
removeBackground(text.getPressedStyle());
removeBackground(text.getDisabledStyle());
actualButton = new Button();
actualButton.setUIID("icon");
addComponent(BorderLayout.WEST, actualButton);
addComponent(BorderLayout.CENTER, text);
setLeadComponent(actualButton);
}
示例5: showLoginForm
import com.codename1.ui.Button; //导入方法依赖的package包/类
private void showLoginForm() {
Form loginForm = new Form();
loginForm.getTitleArea().setUIID("Container");
loginForm.setLayout(new BorderLayout());
loginForm.setUIID("MainForm");
Container cnt = new Container(new BoxLayout(BoxLayout.Y_AXIS));
cnt.setUIID("Padding");
Button loginWithGoogle = new Button("Signin with Google");
loginWithGoogle.setUIID("LoginButtonGoogle");
Button loginWithFacebook = new Button("Signin with Facebook");
loginWithFacebook.setUIID("LoginButtonFacebook");
Style iconFontStyle = UIManager.getInstance().getComponentStyle("IconFont");
loginWithFacebook.setIcon(FontImage.create(" \ue96c ", iconFontStyle));
loginWithGoogle.setIcon(FontImage.create(" \ue976 ", iconFontStyle));
cnt.addComponent(loginWithGoogle);
cnt.addComponent(loginWithFacebook);
loginWithGoogle.addActionListener((e) -> {
Dialog.show("Test", "Test", "OK", null);
tokenPrefix = "google";
Login gc = GoogleConnect.getInstance();
gc.setScope("profile email https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.me");
gc.setClientId("1013232201263-lf4aib14r7g6mln58v1e36ibhktd79db.apps.googleusercontent.com");
gc.setRedirectURI("https://www.codenameone.com/oauth2callback");
gc.setClientSecret("uvu03IXOhx9sO8iPcmDfuX3R");
doLogin(gc, new GoogleData(), false);
});
loginWithFacebook.addActionListener((e) -> {
tokenPrefix = "facebook";
Login fb = FacebookConnect.getInstance();
fb.setClientId("739727009469185");
fb.setRedirectURI("http://www.codenameone.com/");
fb.setClientSecret("4c4a7df81a8e9ab29ac4e38e6b9e4eb1");
doLogin(fb, new FacebookData(), false);
});
loginForm.addComponent(BorderLayout.SOUTH, cnt);
loginForm.show();
}
示例6: dealCard
import com.codename1.ui.Button; //导入方法依赖的package包/类
/**
* A blocking method that creates the card deal animation and binds the drop logic when cards are dropped on the deck
*/
private void dealCard(Component deck, final Container destination, Image cardImage, Card currentCard) {
final Button card = new Button();
card.setUIID("Label");
card.setIcon(cardImage);
// Components are normally placed by layout managers so setX/Y/Width/Height shouldn't be invoked. However,
// in this case we want the layout animation to deal from a specific location. Notice that we use absoluteX/Y
// since the default X/Y are relative to their parent container.
card.setX(deck.getAbsoluteX());
int deckAbsY = deck.getAbsoluteY();
if(destination.getY() > deckAbsY) {
card.setY(deckAbsY - destination.getAbsoluteY());
} else {
card.setY(deckAbsY);
}
card.setWidth(deck.getWidth());
card.setHeight(deck.getHeight());
destination.addComponent(card);
// we save the model data directly into the component so we don't need to keep track of it. Later when we
// need to check the card type a user touched we can just use getClientProperty
card.putClientProperty("card", currentCard);
destination.getParent().animateHierarchyAndWait(400);
card.setDraggable(true);
// when the user drops a card on a drop target (currently only the deck) we remove it and animate it out
card.addDropListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
evt.consume();
card.getParent().removeComponent(card);
destination.animateLayout(300);
}
});
}
示例7: createDemo
import com.codename1.ui.Button; //导入方法依赖的package包/类
private Button createDemo(Demo d) {
Button btn = new Button(d.getDisplayName(), d.getDemoIcon());
btn.setUIID("DemoButton");
initDemoButtonMargin(btn.getUnselectedStyle());
initDemoButtonMargin(btn.getSelectedStyle());
initDemoButtonMargin(btn.getPressedStyle());
initDemoButtonMargin(btn.getDisabledStyle());
btn.setTextPosition(Button.TOP);
return btn;
}
示例8: Login
import com.codename1.ui.Button; //导入方法依赖的package包/类
public Login(Form f) {
super("Login Form");
this.main = f;
setLayout(new LayeredLayout());
Button login = new Button(FBDemo.getTheme().getImage("SignInFacebook.png_veryHigh.png"));
login.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
signIn(main);
}
});
login.setUIID("CenterLabel");
addComponent(login);
}
示例9: createNodeComponent
import com.codename1.ui.Button; //导入方法依赖的package包/类
/**
* Creates a node within the tree, this method is protected allowing tree to be
* subclassed to replace the rendering logic of individual tree buttons.
*
* @param node the node object from the model to display on the button
* @param depth the depth within the tree (normally represented by indenting the entry)
* @return a button representing the node within the tree
* @deprecated replaced with createNode, bindNodeListener and setNodeIcon
*/
protected Button createNodeComponent(Object node, int depth) {
Button cmp = new Button(childToDisplayLabel(node));
cmp.setUIID("TreeNode");
if(model.isLeaf(node)) {
cmp.setIcon(nodeImage);
} else {
cmp.setIcon(folder);
}
updateNodeComponentStyle(cmp.getSelectedStyle(), depth);
updateNodeComponentStyle(cmp.getUnselectedStyle(), depth);
updateNodeComponentStyle(cmp.getPressedStyle(), depth);
return cmp;
}
示例10: show
import com.codename1.ui.Button; //导入方法依赖的package包/类
public static void show(String title, String text, final Command cmd)
{
int popupWidth = Display.getInstance().getCurrent().getWidth() - StateMachine.getPixelFromMM(10, true);
if(popupWidth > StateMachine.getPixelFromMM(40,true))
popupWidth = StateMachine.getPixelFromMM(40,true);
final Dialog dia = new Dialog();
dia.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
dia.getDialogStyle().setBgTransparency(0);
Command backCommand = new Command(null){
@Override
public void actionPerformed(ActionEvent ev) {
dia.dispose();
}
};
dia.setBackCommand(backCommand);
SpanLabel lblTitle = new SpanLabel(title);
lblTitle.setUIID("ViewOptionsRowFirst");
lblTitle.setTextUIID("ViewOptionsRowFirstText");
lblTitle.setPreferredW(popupWidth);
dia.addComponent(lblTitle);
SpanLabel lblText = new SpanLabel(text);
lblText.setUIID("ViewOptionsRow");
lblText.setTextUIID("ViewOptionsRowText");
lblText.setPreferredW(popupWidth);
dia.addComponent(lblText);
Container ctn = new Container(new LayeredLayout());
Button closebg = new Button();
closebg.setUIID("ViewOptionsRowLast");
closebg.getStyle().setBgTransparency(0);
closebg.setPreferredW(popupWidth);
ctn.addComponent(closebg);
Container ctnButtons = new Container(new BoxLayout(BoxLayout.Y_AXIS));
ctnButtons.getStyle().setMargin(StateMachine.getPixelFromMM(2, false), StateMachine.getPixelFromMM(2, false), StateMachine.getPixelFromMM(2, true), StateMachine.getPixelFromMM(2, true));
ctn.addComponent(ctnButtons);
Button close = new Button(StateMachine._translate("button_ok", "[default] Ok"));
if (cmd != null && cmd.getCommandName() != null)
close.setText(cmd.getCommandName());
close.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (cmd != null)
cmd.actionPerformed(evt);
dia.dispose();
}
});
close.setUIID("ViewOptionsRowClose");
close.setVerticalAlignment(Label.CENTER);
ctnButtons.addComponent(close);
dia.addComponent(ctn);
dia.showPacked(BorderLayout.CENTER, true);
}
示例11: createEntry
import com.codename1.ui.Button; //导入方法依赖的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: SignatureComponent
import com.codename1.ui.Button; //导入方法依赖的package包/类
/**
* Creates a new signature component.
*/
public SignatureComponent() {
setLayout(new BorderLayout());
xFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE);
lead = new Button() {
@Override
protected void paintBackground(Graphics g) {
super.paintBackground(g);
g.setColor(0x666666);
Style s = getStyle();
g.drawRect(
getX()+s.getPaddingLeftNoRTL(),
getY()+s.getPaddingTop(),
getWidth()-s.getPaddingRightNoRTL()-s.getPaddingLeftNoRTL(),
getHeight()-s.getPaddingBottom() - s.getPaddingTop()
);
g.setFont(xFont);
g.drawString("X", getX() + getStyle().getPaddingLeftNoRTL() + Display.getInstance().convertToPixels(3, true), getY() + getHeight() / 2);
}
};
lead.setText(localize("SignatureComponent.LeadText","Press to sign"));
lead.setUIID("SignatureButton");
lead.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
final Dialog dialog = new Dialog(localize("SignatureComponent.DialogTitle", "Sign Here"));
final SignatureDialogBody sigBody = new SignatureDialogBody() {
@Override
protected void onCancel() {
super.onCancel();
dialog.dispose();
}
};
sigBody.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent sigDoneEvent) {
dialog.dispose();
setSignatureImage(sigBody.getValue());
fireActionEvent();
}
});
dialog.setLayout(new BorderLayout());
dialog.addComponent(BorderLayout.CENTER, sigBody);
dialog.setScrollable(false);
dialog.setFocusable(false);
dialog.show();
}
});
addComponent(BorderLayout.CENTER, lead);
}