method आप का इस्तेमाल किया है है:
public static String showInputDialog(Component parentComponent,
Object message,
Object initialSelectionValue)
यहाँ 3 तर्क (initialSelectionValue
) पाठ फ़ील्ड में डिफ़ॉल्ट मान है। आपने JOptionPane.QUESTION_MESSAGE
को तीसरे तर्क के रूप में दिया है जो एक int निरंतर मूल्य = 3 है। इसलिए आपको पाठ फ़ील्ड में दर्ज डिफ़ॉल्ट मान के रूप में 3 मिलता है।
इस प्रयास करें:
String input = JOptionPane.showInputDialog(null,
"Please enter new quantity", "");
या इस
String input = JOptionPane.showInputDialog(null,
"Please enter new quantity", "Please enter new quantity",
JOptionPane.QUESTION_MESSAGE);
स्रोत
2011-07-20 13:51:13
क्या आप "डिफ़ॉल्ट टेक्स्ट" द्वारा मतलब है? –
टेक्स्ट फ़ील्ड में पाठ जो पहले से ही –