import javax.swing.JOptionPane;

// leitura das horas com JOptionPane
public class LeituraHorasPainel {

	public static void main(String[] args) {
		
	    String msg = "Hora no formato hh:mm:ss";
		String texto = JOptionPane.showInputDialog(null, msg, "Que horas são?", JOptionPane.QUESTION_MESSAGE);
		
		if (texto != null) {
			String[] horas = texto.split(":");
		
			if (horas.length < 3)
				System.out.println("Você esqueceu de digitar os segundos!");
			else
				System.out.printf("\nHoras = %2s \nMinutos = %2s \nSegundos = %2s",
								   horas[0], horas[1], horas[2]);
		}
		
	}

}
