ConfirmDialog

3 respostas
J
JOptionPane.showConfirmDialog(null,"Deseja Excluir ? ","Excluir",JOptionPane.YES_NO_CANCEL_OPTION);
					String message = null;
					String  returnValue =  (String)e.getSource();
					if (returnValue == JOptionPane.YES_OPTION)
						message = "Yes";
					  else if (returnValue == JOptionPane.NO_OPTION)
						message = "No";
					System.out.println("User selected: " + message);

:roll:

Problema:
Incompatible operand types String and int Principal.java

Incompatibilidade de tipos inteiro e String mas

Qual a forma certa de perguntar se o botão YES foi pressionado ?

[/code]

3 Respostas

E

.showConfirmDialog retorna um int dizendo qual a opção escolhida.

int escolha = JOptionPane.showConfirmDialog(null,"Deseja Excluir ? ","Excluir",JOptionPane.YES_NO_CANCEL_OPTION);
:smiley:

J

Não precisa responder

Já resolvi…

E
Criado 26 de fevereiro de 2004
Ultima resposta 26 de fev. de 2004
Respostas 3
Participantes 2