누군가 내게 java를 가르쳐 줄 수 있습니까? 아래의 코드는 JOptionPane을 사용하는 것 뿐이며 사용자에게 데이터를 가져 오기위한 입력 대화 상자에 대한 것입니다.JOptionPane 입력 대화 상자
컨셉 : 첫 번째 옵션은 트랜잭션을 선택하는 것입니다. 그런 다음 다른 입력 대화 상자가 PIN을 묻는 메시지를 표시 한 다음 다른 입력 대화 상자에 철회, 잔액 확인, 입금 및 종료와 같은 4 가지 옵션이 표시됩니다.
다른 입력 대화 상자를 표시하는 과정은 무엇이며 이전 입력 대화 상자로 돌아가는 과정은 무엇입니까? 그런 다음 입력이 잘못된 경우 먼저 메시지 대화 상자를 표시하고 이전 입력 대화 상자로 돌아가려면 사용자 입력의 유효성을 검사하는 프로세스는 무엇입니까? 좋아
import javax.swing.*;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
String myOptions = "S = Select Transaction\n"
+ "Q = Quit\n"
+ "Enter your choice";
String myPin = "Enter your PIN";
String Y = "Yes";
String N = "No";
String value = JOptionPane.showInputDialog(
null, myOptions, "Computerized Automatic Teller Machine", 1);
if (value.equals("S")) {
JOptionPane.showInputDialog(
null, myPin, "Computerized Automatic Teller Machine", 1);
} else if (value.equals("Q")) {
JOptionPane.showMessageDialog(
null, "Are you sure you want to exit?",
"Computerized Automatic Teller Machine", 1);
} else {
JOptionPane.showMessageDialog(
null, "Please the correct letter!",
"Computerized Automatic Teller Machine", 1);
JOptionPane.showInputDialog(null, myOptions,
"Computerized Automatic Teller Machine", 1);
}
}
}//end of class
안녕하세요. 당신의 응답을 주셔서 감사합니다. 나는 당신의 코드를 이해한다고 생각합니다. 나는 지금 그것을 시도하고 알려 드리겠습니다 :) – keyframer
안녕하세요. 다음 문제는 PIN이 데이터베이스에서 찾아야한다는 것입니다. 어떻게 그것을 데이터베이스 테이블에 찾는 방법을 삽입 할 수 있습니다. 아래는 데이터베이스에서 정보를 읽는 다른 클래스입니다. – keyframer
public void getPersonInfo (int selID) { 시도 { \t String msg = ""; \t 문자열 myQuery = ""; \t myQuery = "성, 이름 선택"+ \t \t \t "tblPerson WHERE PersonID ="+ selID; \t 명세서 myCommand = con.createStatement(); \t ResultSet selRecord = myCommand.executeQuery (myQuery); \t selRecord.다음 것(); \t msg = "ID"+ ""+ "이름 \ n"; \t msg + = selID + ""+ selRecord.getString (1) + ""+ selRecord.getString (2); \t JOptionPane.showMessageDialog (null, msg); \t selRecord.close(); \t myCommand.close(); } catch (Exception e) { \t JOptionPane.showMessageDialog (null, e); \t \t \t \t } – keyframer