Hi,

Place a small validation on the indicated method that showed a message with 
the Dialog component when the condition is met. To my surprise the message 
appears 2 times in a row. Validate that you were not changing the content 
of the field (textarea component) in any other point of the logic.

My code:

        txTamano.addActionListener((e) -> {
            if (!txTamano.getText().isEmpty()) {
                if (!*unidadMedidaValida*(txTamano.getText(), 
unidadMedida())) {
                    Dialog.show(idioma.getAdvertencia(), 
idioma.getMensaje57(), idioma.getContinuar(), null);
                }
            }
        });

    public boolean *unidadMedidaValida*(String uMa, String uM[]) {
        boolean resp = false;
        String umArticulo = new String();
        for (int i = 0; i < uMa.length(); i++) {
            char c = uMa.charAt(i);
            if (c >= '0' && c <= '9' || c == '.' || c == ' ') {
                continue;
            }
            umArticulo = uMa.substring(i, uMa.length());
            break;
        }
        if (!umArticulo.isEmpty()) {
            for (int x = 0; x < uM.length; x++) {
                String[] pA = Util.split((String) uM[x], " ");
                for (int y = 0; y < pA.length; y++) {
                    if 
(umArticulo.toLowerCase().equals(pA[y].toLowerCase())) {
                        resp = true;
                        break;
                    }
                }
            }
        }
        return resp;
    }

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/27d497ab-ed9f-4483-9aa1-7430082422bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to