Page 460 - MDP2022-2
P. 460
if(a.getActionCommand().equals("확인")){
try (var pst = DBhandler.con.prepareStatement("select *
from item where i_selled = false")) {
var rs = pst.executeQuery();
rs.next();
var pw = rs.getString("i_pw");
var socket = new Socket("192.168.137.200",4000);
var os = socket.getOutputStream();
if(this.keywords.equals(pw)){
JOptionPane.showMessageDialog(null, "맞았습니
다.", "정보",JOptionPane.INFORMATION_MESSAGE );
os.write( "r".getBytes() );
os.flush();
socket.close();
inputField.setText("");
keywords = "";
AppMain.pad.onClick();
}else{
JOptionPane.showMessageDialog(null, "틀렸습니
다.","경고", JOptionPane.ERROR_MESSAGE);
inputField.setText("");
os.write( "y".getBytes() );
keywords = "";
shuffleInput();
}
} catch (SQLException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else if(a.getActionCommand().equals("취소")){
inputField.setText("");
keywords = "";
}else{
if(inputField.getText().length() >= 4 )