本文整理汇总了Java中com.codename1.ui.Dialog.addComponent方法的典型用法代码示例。如果您正苦于以下问题:Java Dialog.addComponent方法的具体用法?Java Dialog.addComponent怎么用?Java Dialog.addComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.codename1.ui.Dialog
的用法示例。
在下文中一共展示了Dialog.addComponent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: authenticate
import com.codename1.ui.Dialog; //导入方法依赖的package包/类
/**
* This method preforms the actual authentication, this method is a blocking
* method that will display the user the html authentication pages.
*
* @return the method if passes authentication will return the access token
* or null if authentication failed.
*
* @throws IOException the method will throw an IOException if something
* went wrong in the communication.
* @deprecated use createAuthComponent or showAuthentication which work
* asynchronously and adapt better to different platforms
*/
public String authenticate() {
if (token == null) {
login = new Dialog();
boolean i = Dialog.isAutoAdjustDialogSize();
Dialog.setAutoAdjustDialogSize(false);
login.setLayout(new BorderLayout());
login.setScrollable(false);
Component html = createLoginComponent(null, null, null, null);
login.addComponent(BorderLayout.CENTER, html);
login.setScrollable(false);
login.setDialogUIID("Container");
login.setTransitionInAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL, true, 300));
login.setTransitionOutAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL, false, 300));
login.show(0, 0, 0, 0, false, true);
Dialog.setAutoAdjustDialogSize(i);
}
return token;
}
示例2: authenticate
import com.codename1.ui.Dialog; //导入方法依赖的package包/类
/**
* This method preforms the actual authentication, this method is a blocking
* method that will display the user the html authentication pages.
*
* @return the method if passes authentication will return the access token
* or null if authentication failed.
*
* @throws IOException the method will throw an IOException if something went
* wrong in the communication.
* @deprecated use createAuthComponent or showAuthentication which work asynchronously and adapt better
* to different platforms
*/
public String authenticate() {
if (token == null) {
login = new Dialog();
boolean i = Dialog.isAutoAdjustDialogSize();
Dialog.setAutoAdjustDialogSize(false);
login.setLayout(new BorderLayout());
login.setScrollable(false);
Component html = createLoginComponent(null, null, null, null);
login.addComponent(BorderLayout.CENTER, html);
login.setScrollable(false);
login.setDialogUIID("Container");
login.setTransitionInAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL, true, 300));
login.setTransitionOutAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL, false, 300));
login.show(0, 0, 0, 0, false, true);
Dialog.setAutoAdjustDialogSize(i);
}
return token;
}
示例3: showInifiniteBlocking
import com.codename1.ui.Dialog; //导入方法依赖的package包/类
/**
* Shows the infinite progress over the whole screen
*/
public Dialog showInifiniteBlocking() {
Form f = Display.getInstance().getCurrent();
if(f == null) {
f = new Form();
f.show();
}
int i = f.getTintColor();
f.setTintColor(0x90000000);
Dialog d = new Dialog();
d.setDialogUIID("Container");
d.setLayout(new BorderLayout());
d.addComponent(BorderLayout.CENTER, this);
d.setTransitionInAnimator(CommonTransitions.createEmpty());
d.setTransitionOutAnimator(CommonTransitions.createEmpty());
d.showPacked(BorderLayout.CENTER, false);
return d;
}
示例4: exception
import com.codename1.ui.Dialog; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void exception(Throwable t) {
Preferences.set("$CN1_pendingCrash", true);
if(promptUser) {
Dialog error = new Dialog("Error");
error.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
TextArea txt = new TextArea(errorText);
txt.setEditable(false);
txt.setUIID("DialogBody");
error.addComponent(txt);
CheckBox cb = new CheckBox(checkboxText);
cb.setUIID("DialogBody");
error.addComponent(cb);
Container grid = new Container(new GridLayout(1, 2));
error.addComponent(grid);
Command ok = new Command(sendButtonText);
Command dont = new Command(dontSendButtonText);
Button send = new Button(ok);
Button dontSend = new Button(dont);
grid.addComponent(send);
grid.addComponent(dontSend);
Command result = error.showPacked(BorderLayout.CENTER, true);
if(result == dont) {
if(cb.isSelected()) {
Preferences.set("$CN1_crashBlocked", true);
}
Preferences.set("$CN1_pendingCrash", false);
return;
} else {
if(cb.isSelected()) {
Preferences.set("$CN1_prompt", false);
}
}
}
Log.sendLog();
Preferences.set("$CN1_pendingCrash", false);
}
示例5: exception
import com.codename1.ui.Dialog; //导入方法依赖的package包/类
/**
* @inheritDoc
*/
public void exception(Throwable t) {
Preferences.set("$CN1_pendingCrash", true);
if(promptUser) {
Dialog error = new Dialog("Error");
error.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
TextArea txt = new TextArea(errorText);
txt.setEditable(false);
txt.setUIID("DialogBody");
error.addComponent(txt);
CheckBox cb = new CheckBox(checkboxText);
cb.setUIID("DialogBody");
error.addComponent(cb);
Container grid = new Container(new GridLayout(1, 2));
error.addComponent(grid);
Command ok = new Command(sendButtonText);
Command dont = new Command(dontSendButtonText);
Button send = new Button(ok);
Button dontSend = new Button(dont);
grid.addComponent(send);
grid.addComponent(dontSend);
Command result = error.showPacked(BorderLayout.CENTER, true);
if(result == dont) {
if(cb.isSelected()) {
Preferences.set("$CN1_crashBlocked", true);
}
Preferences.set("$CN1_pendingCrash", false);
return;
} else {
if(cb.isSelected()) {
Preferences.set("$CN1_prompt", false);
}
}
}
Log.sendLog();
Preferences.set("$CN1_pendingCrash", false);
}
示例6: show
import com.codename1.ui.Dialog; //导入方法依赖的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);
}
示例7: bindTabletLandscapeMaster
import com.codename1.ui.Dialog; //导入方法依赖的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();
}
}
});
}
示例8: bindTabletLandscapeMaster
import com.codename1.ui.Dialog; //导入方法依赖的package包/类
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();
}
}
});
}