private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
char[] pass = pass1.getPassword();
String passString = new String(pass);
String l = "1;"+jTextField1.getText()+"/"+passString+"/";
try{
a.connection_send(l);
\\HEREEE : I want to wait here 2 secondes before continue and doing a.connection_get()
loginInfo = a.connection_get();
if(Integer.parseInt(loginInfo) == 1) {
home_page a = new home_page();
a.setBounds(500, 200, 470, 330);
} else {
JOptionPane.showMessageDialog(null, "Wrong UserName or Password", "Alert !", JOptionPane.WARNING_MESSAGE);
jTextField1.setText("");
pass1.setText("");
}
} catch(Exception e) {
JOptionPane.showMessageDialog(null, "You Are not connected to Server !\nPlease check Your netowrk ", "Alert !", JOptionPane.WARNING_MESSAGE);
}
}
어떻게 아래의 코드에서 타이머를 설정할 수 있습니까? 나는 작은 타이머를 배치 할 위치를 표시했습니다. 그럴 생각이 있습니까? 내 목표는 서버가 데이터를 보낼 준비가 될 때까지 조금 기다리는 것입니다. 그래서 적절한 데이터를받을 수 있습니다!조치를 취하기 전에 타이머를 설정하는 방법은 무엇입니까?
왜 임의 대기를 삽입해야합니까? 나는 당신의'connection_get' 메쏘드가 서버가 데이터를 보낼 때까지 블록 될 것이라고 생각했을 것이다. – SimonC