0

GUI program having lots of bugs

import javax.swing.JOptionPane; public class NumberDialog { public static void main(String[] args) { // Ask the user to enter a number String input = JOptionPane.showInputDialog(null, "Please enter a number:"); try { // Parse the number from the input string int number = Integer.parseInt(input); // Display the number in a message dialog JOptionPane.showMessageDialog(null, "You entered: " + number); } catch (NumberFormatException e) { // Handle invalid input by displaying an error message JOptionPane.showMessageDialog(null, "Invalid input. Please enter a valid integer."); } } }

26th Mar 2023, 12:12 PM
Ikran
Ikran - avatar
2 Réponses
+ 2
Sololearn doesn't support GUI so you should try on any IDE.
26th Mar 2023, 12:46 PM
A͢J
A͢J - avatar
0
Okay
26th Mar 2023, 12:50 PM
Ikran
Ikran - avatar