当前位置: 首页>>代码示例>>Java>>正文


Java Form.getFocused方法代码示例

本文整理汇总了Java中com.codename1.ui.Form.getFocused方法的典型用法代码示例。如果您正苦于以下问题:Java Form.getFocused方法的具体用法?Java Form.getFocused怎么用?Java Form.getFocused使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.codename1.ui.Form的用法示例。


在下文中一共展示了Form.getFocused方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showKeyboard

import com.codename1.ui.Form; //导入方法依赖的package包/类
public void showKeyboard(boolean show) {
//        manager.restartInput(myView);
//        if (keyboardShowing != show) {
//            manager.toggleSoftInputFromWindow(myView.getWindowToken(), 0, 0);
//            this.keyboardShowing = show;
//        }
        System.out.println("showKeyboard " + show);
        Form current = Display.getInstance().getCurrent();
        if(current != null){
            Component cmp = current.getFocused();
            if(cmp != null && cmp instanceof TextArea){
                TextArea txt = (TextArea)cmp;
                if(show){
                    Display.getInstance().editString(txt, txt.getMaxSize(), txt.getConstraint(), txt.getText(), 0);
                }
            }
        }else{
            InPlaceEditView.endEdit();
        }
//        if(!show){
//            impl.saveTextEditingState();
//        }
    }
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:24,代码来源:AndroidKeyboard.java

示例2: getFormState

import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
 * Returns the state of the current form which we are about to leave as part
 * of the navigation logic. When a back command will return to this form the
 * state would be restored using setFormState.
 * The default implementation of this method restores focus and list selection.
 * You can add arbitrary keys to the form state, keys starting with a $ sign
 * are reserved for the UIBuilder base class use.
 *
 * @param f the form whose state should be preserved
 * @return arbitrary state object
 */
protected Hashtable getFormState(Form f) {
    Component c = f.getFocused();
    Hashtable h = new Hashtable();
    // can happen if we navigate away from a form that was shown without the GUI builder
    if(f.getName() != null) {
        h.put(FORM_STATE_KEY_NAME, f.getName());
    }
    if(c != null) {
        if(c instanceof List) {
            h.put(FORM_STATE_KEY_SELECTION, new Integer(((List)c).getSelectedIndex()));
        }
        if(c.getName() != null) {
            h.put(FORM_STATE_KEY_FOCUS, c.getName());
        }
        if(f.getTitle() != null) {
            h.put(FORM_STATE_KEY_TITLE, f.getTitle());
        }
    }
    storeComponentState(f, h);
    return h;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:33,代码来源:UIBuilder.java

示例3: getContainerState

import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
 * This method is the container navigation equivalent of getFormState() see
 * that method for details.
 * @param cnt the container
 * @return the state
 */
protected Hashtable getContainerState(Container cnt) {
    Component c = null;
    Form parentForm = cnt.getComponentForm();
    if(parentForm != null) {
        c = parentForm.getFocused();
    }
    Hashtable h = new Hashtable();
    h.put(FORM_STATE_KEY_NAME, cnt.getName());
    h.put(FORM_STATE_KEY_CONTAINER, "");
    if(c != null && isParentOf(cnt, c)) {
        if(c instanceof List) {
            h.put(FORM_STATE_KEY_SELECTION, new Integer(((List)c).getSelectedIndex()));
        }
        if(c.getName() != null) {
            h.put(FORM_STATE_KEY_FOCUS, c.getName());
        }
        return h;
    }
    storeComponentState(cnt, h);
    return h;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:28,代码来源:UIBuilder.java

示例4: showKeyboard

import com.codename1.ui.Form; //导入方法依赖的package包/类
public void showKeyboard(boolean show) {
    // we need this since when opening the VKB the text field loses focus and tries to fold the keyboard for some reason
    if(blockFolding && !show) {
        return;
    }
    if(canvas.getVirtualKeyboard() == null){
        return;
    }
    if(show) { 
        if(isVirtualKeyboardShowing()){
            return;
        }
        canvas.getVirtualKeyboard().setVisibility(VirtualKeyboard.SHOW);
        
        Form current = canvas.getImplementation().getCurrentForm();
        Component focus = current.getFocused();
        if(focus != null && focus instanceof TextArea){
            TextArea txtCmp = (TextArea) focus;
            if((txtCmp.getConstraint() & TextArea.NON_PREDICTIVE) == 0){
                canvas.getImplementation().editString(txtCmp, txtCmp.getMaxSize(), txtCmp.getConstraint(), txtCmp.getText(), 0);
            }
        }            
    } else {
        canvas.getVirtualKeyboard().setVisibility(VirtualKeyboard.HIDE);
        canvas.getImplementation().finishEdit(true);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:28,代码来源:BlackBerryVirtualKeyboard.java

示例5: paint

import com.codename1.ui.Form; //导入方法依赖的package包/类
public void paint(Graphics g) {
    int f = getFieldCount();
    if(f > 0) {
        g.drawBitmap(0, 0, getWidth(), getHeight(), screen, 0, 0);

        Form currentForm = Display.getInstance().getCurrent();
        for(int iter = 0 ; iter < f ; iter++) {
            Field fld = getField(iter);
            int pops = 0;
            if(currentForm != null) {
                PeerComponent p = findPeer(currentForm.getContentPane(), fld);
                if(p != null) {
                    pops = clipOnLWUITBounds(p, g);
                } else {
                    Component cmp = currentForm.getFocused();

                    // we are now editing an edit field
                    if(cmp != null && cmp instanceof TextArea && cmp.hasFocus() && fld instanceof EditField) {
                        pops = clipOnLWUITBounds(cmp, g);
                        int x = fld.getLeft();
                        int y = fld.getTop();
                        g.clear(x, y, Math.max(cmp.getWidth(), fld.getWidth()),
                                Math.max(cmp.getHeight(), fld.getHeight()));
                    }
                }
            }
            paintChild(g, fld);
            while(pops > 0) {
                g.popContext();
                pops--;
            }
        }
    } else {
        g.drawBitmap(0, 0, getWidth(), getHeight(), screen, 0, 0);
    }
    g.setColor(0);
    g.drawText(debug, 0, 0);
    painted = true;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:40,代码来源:BlackBerryCanvas.java

示例6: getSelectedRow

import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
 * Returns the selected row in the table
 *
 * @return the offset of the selected row in the table if a selection exists
 */
public int getSelectedRow() {
    Form f = getComponentForm();
    if(f != null) {
        Component c = f.getFocused();
        if(c != null) {
            return getCellRow(c);
        }
    }
    return -1;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:16,代码来源:Table.java

示例7: getSelectedColumn

import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
 * Returns the selected column in the table
 *
 * @return the offset of the selected column in the table if a selection exists
 */
public int getSelectedColumn() {
    Form f = getComponentForm();
    if(f != null) {
        Component c = f.getFocused();
        if(c != null) {
            return getCellColumn(c);
        }
    }
    return -1;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:16,代码来源:Table.java


注:本文中的com.codename1.ui.Form.getFocused方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。