本文整理汇总了Java中com.codename1.ui.Form.addSizeChangedListener方法的典型用法代码示例。如果您正苦于以下问题:Java Form.addSizeChangedListener方法的具体用法?Java Form.addSizeChangedListener怎么用?Java Form.addSizeChangedListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.codename1.ui.Form
的用法示例。
在下文中一共展示了Form.addSizeChangedListener方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleSizeChange
import com.codename1.ui.Form; //导入方法依赖的package包/类
public void handleSizeChange(int w, int h) {
if(!drawing) {
if ((this.width != w && (this.width < w || this.height < h))
|| (bitmap.getHeight() < h)) {
this.initBitmaps(w, h);
}
}
if (this.width == w && this.height == h) {
return;
}
this.width = w;
this.height = h;
Log.d("Codename One", "sizechanged: " + width + " " + height + " " + this);
if (this.implementation.getCurrentForm() == null) {
/**
* make sure a form has been set before we can send events to the
* EDT. if we send events before the form has been set we might
* deadlock!
*/
return;
}
if (InPlaceEditView.isEditing()) {
final Form f = this.implementation.getCurrentForm();
ActionListener sizeChanged = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
CodenameOneView.this.implementation.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
InPlaceEditView.reLayoutEdit();
InPlaceEditView.scrollActiveTextfieldToVisible();
}
});
f.removeSizeChangedListener(this);
}
};
f.addSizeChangedListener(sizeChanged);
}
Display.getInstance().sizeChanged(w, h);
}