Javaì�˜ Swing 중 JOptionPane 으로 ìž…ë ¥ê³¼ ì¶œë ¥ì�„ 받는 ì˜ˆì œ.
ì�´ê±´ ì œê°€ 프로그래ë°� 하는 습관ì�´ ë§Žì�´ ë°˜ì˜�ë�˜ì—ˆìœ¼ë¯€ë¡œ ì™„ì „ížˆ ë”°ë�¼í•˜ì§€ 않았으면 합니다. 그냥 ì°¸ê³ ë§Œ 하세요.
ì˜ˆì œì½”ë“œ ¶
- 주ì„�ì�€ ì™ ë§Œí•˜ë©´ ì˜�문으로 ë‹¬ê² ìŠµë‹ˆë‹¤. -_-+
~cpp
import javax.swing.JOptionPane;
public class InputOutputExample {
private String input = "";
private String output = "";
public InputOutputExample() { // Constructor
// input string
input = inputDialogbox("Enter the first word : ");
output += input; // add text to String instance;
input = inputDialogbox("Enter the second word : ");
output += input; // add text to String instance;
outputDialogbox(output);
}
public static void main(String[] args) {
InputOutputExample example = new InputOutputExample();
}
public String inputDialogbox(String text) {
// Shows a question-message dialog requesting
// input from the user parented to parentComponent.
return JOptionPane.showInputDialog(null, text);
}
public void outputDialogbox(String message) {
// Brings up an information-message dialog titled "Message".
JOptionPane.showMessageDialog(null, message);
}
}










