Alguém consegue enxergar o erro?
try{
String palavra = palavraPesquisa.getText();
String txt = textoAberto.getText();
if(txt.contains(palavra)){
String[] textoSeparado = txt.split("\\s");
for(String s : textoSeparado){
if(s.equals(palavra)){
novoTexto = novoTexto.concat(s.toUpperCase());
}else{
novoTexto = novoTexto.concat(s);
}
}
}else{
JOptionPane.showMessageDialog(null, "O texto não contem essa palavra!");
}
textoAberto.setText(novoTexto);
}catch(Exception e){
e.printStackTrace();
}
}