-4
I would like to know how to add 1 more check. I would like to have row 31 checked as well. Example:
Object obj2 = modelo.getValueAt(linha, 31);
In this code here.
else if (snreferencia.contains("Sim")) {
Object obj = modelo.getValueAt(linha, 30);
if (obj == null || obj.toString().trim().isEmpty()) {
modelo.setValueAt("", linha, 33);
} else {
modelo.setValueAt("Referência", linha, 33);
}
}
I tried to do it that way, but I couldn’t
else if (snreferencia.contains("Sim")) {
Object obj = modelo.getValueAt(linha, 30);
Object obj2 = modelo.getValueAt(linha, 31);
if (obj == null || obj.toString().trim().isEmpty()) {
modelo.setValueAt("", linha, 33);
}
if (obj2 == null || obj2.toString().trim().isEmpty()) {
modelo.setValueAt("", linha, 33);
} else {
modelo.setValueAt("Referência", linha, 33);
}
}
as it is currently
public void VerificarResultdoEnter() {
int linha = tabela1.getSelectedRow() -1;
int coluna = tabela1.getSelectedColumn();
String tipo = tabela1.getValueAt(linha, 26).toString();
String snreferencia = tabela1.getValueAt(linha, 21).toString();
if (tipo.contains("Texto") && !snreferencia.contains("Sim")) {
String valor1 = tabela1.getValueAt(linha, 27).toString(); //Especificacao
String valor2 = tabela1.getValueAt(linha, 31).toString(); //Valor digitado pelo usuario
if (valor1.equals(valor2)) {
modelo.setValueAt("Aprovado", linha, 33);
// modelo.isCellEditable(linha, 32);
} else {
modelo.setValueAt("Reprovado", linha, 33);
}
Object obj = modelo.getValueAt(linha, 31);
if (obj == null || obj.toString().trim().isEmpty()) {
modelo.setValueAt("", linha, 33);
}
} else if (tipo.contains("Min e Max") && !snreferencia.contains("Sim")) {
Object obj = modelo.getValueAt(linha, 30);
if (obj == null || obj.toString().trim().isEmpty()) {
modelo.setValueAt("", linha, 33);
}
Float valornumerico = Float.parseFloat(modelo.getValueAt(linha, 30).toString()); //Valor digitado pelo usuario
if (valornumerico >= Float.parseFloat(modelo.getValueAt(linha, 17).toString()) && valornumerico <= Float.parseFloat(modelo.getValueAt(linha, 18).toString())) {
modelo.setValueAt("Aprovado", linha, 33);
} else {
modelo.setValueAt("Reprovado", linha, 33);
// modelo.isCellEditable(linha, 32);
}
} else if (tipo.contains("No Min") && !snreferencia.contains("Sim")) {
Object obj = modelo.getValueAt(linha, 30);
if (obj == null || obj.toString().trim().isEmpty()) {
modelo.setValueAt("", linha, 33);
}
Float valornumerico = Float.parseFloat(modelo.getValueAt(linha, 30).toString()); //Valor digitado pelo usuario
if (valornumerico >= Float.parseFloat(modelo.getValueAt(linha, 17).toString())) {
modelo.setValueAt("Aprovado", linha, 33);
} else {
modelo.setValueAt("Reprovado", linha, 33);
// modelo.isCellEditable(linha, 32);
}
} else if (tipo.contains("No Max") && !snreferencia.contains("Sim")) {
Object obj = modelo.getValueAt(linha, 30);
if (obj == null || obj.toString().trim().isEmpty()) {
modelo.setValueAt("", linha, 33);
}
Float valornumerico = Float.parseFloat(modelo.getValueAt(linha, 30).toString()); //Valor digitado pelo usuario
if (valornumerico <= Float.parseFloat(modelo.getValueAt(linha, 18).toString())) {
modelo.setValueAt("Aprovado", linha, 33);
} else {
modelo.setValueAt("Reprovado", linha, 33);
// modelo.isCellEditable(linha, 32);
}
} else if (tipo.contains("ValorUnico") && !snreferencia.contains("Sim")) {
Object obj = modelo.getValueAt(linha, 30);
if (obj == null || obj.toString().trim().isEmpty()) {
modelo.setValueAt("", linha, 33);
}
Float valornumerico = Float.parseFloat(modelo.getValueAt(linha, 30).toString()); //Valor digitado pelo usuario
if (valornumerico == Float.parseFloat(modelo.getValueAt(linha, 17).toString())) {
modelo.setValueAt("Aprovado", linha, 33);
} else {
modelo.setValueAt("Reprovado", linha, 33);
// modelo.isCellEditable(linha, 32);
}
} else if (snreferencia.contains("Sim")) {
Object obj = modelo.getValueAt(linha, 30);
if (obj == null || obj.toString().trim().isEmpty()) {
modelo.setValueAt("", linha, 33);
} else {
modelo.setValueAt("Referência", linha, 33);
}
}
}
the way it is, it’s working fine, but I’m just having a problem..
else if (snreferencia.contains("Sim")) {
Object obj = modelo.getValueAt(linha, 30);
if (obj == null || obj.toString().trim().isEmpty()) {
modelo.setValueAt("", linha, 33);
} else {
modelo.setValueAt("Referência", linha, 33);
}
}
I tried to include to check the 31 column, but he either checks the 31 or checks the 30, I’m able to put the 2, if you can help me, I appreciate.
Verified what? Where? Add a [mcve], your doubt is not clear.
– user28595
I would just like to know how to include this second line
– Rafael Chaves
This smells like a tablemodel scam. But if you don’t provide a [mcve] of it is difficult to analyze something.
– user28595
There’s no way I taught you how to gambiarra, hardly any useful. Gambiarra is just a way around something you don’t quite understand how to do it the right way. And I have no idea what that code does, it doesn’t make any sense to me.
– user28595
Related: https://answall.com/q/227074/132
– Victor Stafusa
In your other question, I even started trying to formulate an answer, but I gave up because the question had so many holes in it that I didn’t think it would amount to anything. That other question of yours is far worse.
– Victor Stafusa
wow @Victorstafusa!
– Rafael Chaves
@Rafaelchaves Your question is very bad and for me it would be closed because it is not clear enough. In the meantime, I’ve decided to post an answer anyway to see if it helps you at least explain better what your problem is.
– Victor Stafusa
Do you see? It is no use throwing a piece of code and waiting for someone to turn to understand, it is not for no reason that you have accumulated so many negative votes in your questions, they are almost incomprehensible. Always strive to provide a clear question and code that makes sense and, above all, that is testable, so you will surely get solutions faster. I recommend that read here to see what should be avoided by asking a question.
– user28595
Good morning @Victorstafusam, This is basically what I want, but the problem I’m suffering is with the result "null" as I posted this code ah some time, I made some changes and I’ll post to you see how it turned out. But I really appreciate your help!
– Rafael Chaves