0

例を挙げましょう。このコードはマネージャー内で機能します。

protected boolean navigationMovement(int dx, int dy, int status, int time) {
        int focusIndex = getFieldWithFocusIndex();

        while (dy > 0) {
            if (focusIndex + columnwidth.length >= getFieldCount()) {
                return false;
            } else {
                Field f = getField(focusIndex + columnwidth.length);
                if (f.isFocusable()) {
                    f.setFocus();
                    dy--;
                }
            }
        }

        while (dy < 0) {
            if (focusIndex - columnwidth.length < 0) {
                return false;
            } else {
                Field f = getField(focusIndex - columnwidth.length);
                if (f.isFocusable()) {
                    f.setFocus();
                    dy++;
                }
            }
        }

        while (dx > 0) {
            focusIndex++;
            if (focusIndex >= getFieldCount()) {
                return false;
            } else {
                Field f = getField(focusIndex);
                if (f.isFocusable()) {
                    f.setFocus();
                    dx--;
                }
            }
        }

        while (dx < 0) {
            focusIndex--;
            if (focusIndex < 0) {
                return false;
            } else {
                Field f = getField(focusIndex);
                if (f.isFocusable()) {
                    f.setFocus();
                    dx++;
                }
            }
        }
        return true;
}

今私の画面はこのような3つの異なるマネージャーを追加します。

add(new Custom_TopField(this, 0, -1, "", 1, 1));
add(new Custom_BottomField(this, 0));
add(new Custom_HeaderField(Config_GlobalFunction.latest));

またextends Manager、私が降りるときを除いて、それは下に行く代わりに左に行きます。

4

1 に答える 1

0

解決策を見つけましたが、この解決策はまったく実用的ではありません。すべてのクラスを Java クラス内に作成しました。したがって、クラスを再利用することはできません。

于 2012-08-07T03:22:44.993 に答える