Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners joptionpane validation
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


kwanjiaxian
joptionpane validation
0 Answer(s)      3 years and 3 months ago
Posted in : Java Beginners


import javax.swing.*; import java.util.regex.*; public class joptionpane { public static void main(String[] args){ int category_user = 0; boolean aa = false; do{ String input = JOptionPane.showInputDialog( null,

            "Please select the category \n"
                + "1. IT \n"
                + "2. Science \n"
                + "3. Maths",

                "Input",

                JOptionPane.INFORMATION_MESSAGE
            );
            Pattern p = Pattern.compile("[A-Z,a-z,&%$#@!()*^]");
            Matcher m = p.matcher(input);
            if (m.find()) {
         JOptionPane.showMessageDialog(null, "Please enter only numbers");
            }
            else (m.find())
                    {
             category_user = Integer.parseInt(input);

            }
    }while (!aa || category_user < 1 || category_user>4);

}

\ hello!!please help me!i need to validate the user input on the joptionpane,and if the user enter is a character then it is supposed to return the select category question again.if the user enter correct then the loop will break.however, the following do while will keep looping!how do i modify the codes to make it right?thank for your help.


Advertisement
View Answers

Related Tutorials/Questions & Answers:
joptionpane validation
joptionpane validation  import javax.swing.*; import java.util.regex.*; public class joptionpane { public static void main(String[] args... help me!i need to validate the user input on the joptionpane,and if the user
JOptionPane Validation
JOptionPane Validation JOptionPane allow you to create dialog boxes easily... look complex. Here we are going to validate the textfield of JoptionPane dialog. JOptionPane String Validation We have used regular expression that 
Advertisements
joptionpane - Java Beginners
joptionpane  Hi, I need joptionpane validation. I have joptionpane inputdialog textbox.I need to enter the string values only in the textbox for validation. Please send the sample code immediately. Its very urgent
joptionpane - Java Beginners
joptionpane  Hi, I need joptionpane showinputdialog textbox string validation. Please send the sample code for me. Please its very urgent.... Thanks, Valarmathi  Hi Friend, Try the following code: import
joptionpane - Java Beginners
joptionpane   I need joptionpane showinputdialog textbox integer validation. Please send the sample code for me. Please its very urgent.... Thanks, Valarmathi  Hi Friend, Try the following code: import
joptionpane - Java Beginners
joptionpane  Hi, I need to hide the joptionpane message dialogs... java.util.regex.*; class Validation extends JFrame{ JTextField text; JLabel l1,l2; JPanel p; Validation(){ text=new JTextField(15); l1=new JLabel
validation
validation  validation
validation
validation  we are doing payroll system project in java.So pls provide the complete validation code for employee master form
Array in JOptionPane - Java Beginners
Array in JOptionPane  Hello, I'm having trouble with printing an array in a JOptionPane. I am supposed to make a 2 dimensional int array called BlasTable. I'm supposed to use a method to print the array in a JOptionPane
validation.....
validation.....  hi.......... thanks for ur reply for validation code. but i want a very simple code in java swings where user is allowed to enter only numerical values in textbox , if he enters string values then it should
joptionpane - Java Beginners
joptionpane  Hi, I need to change the JOptionpane foreground text color only. Please send the sample code. JOptionPane.showMessageDialog(createqmbutton, "Succesfully Create the Queue Manager", "Create Queue
Get and Display using JOptionPane
from student, name and age, by using JOptionPane. Then display it. Really
Selection Using JoptionPane
Selection Using JoptionPane  Help, can someone provide me the code using JOptionPane for the following:- Part A 1) Prompt user to make 3 selection i.e 1)Orchid $4.00 2)Rose $2.50 3)Daisy $5.00 or 0 to Quit 2) if user
validation
Validation method valid the in put. otherwise call the javascript onsubmit to check... code.Ok if you use struts then you can use Validation method valid the in put
JOptionPane - Java Beginners
and output should be via JOptionPane dialogue boxes. Examples are shown below
Validation
); JLabel label=new JLabel("JTable validation Example",JLabel.CENTER); JPanel panel=new JPanel(); panel.add(scroll); JFrame frame=new JFrame("JTable validation
validation
validation  please help me to check validation for <form> <table class="form"> <tr> <td class="col1"> <label>Sno:</label> </td> <td
Set Color in JOptionPane
Set Color in JOptionPane       In this section, you will learn how to set color in JOptionPane. Now to do... following key value pair, we have set the background color for JOptionPane
Set delay time in JOptionPane
Set delay time in JOptionPane       In this section, you will learn how to set the time after which the message should be displayed using JOptionpane. For this, first of all we prompt
Set text color in JoptionPane
Set text color in JoptionPane In this section, you will learn how to set text color in JOptionPane. Now to do this, we have used UIManager class which... color for JOptionPane and background color for JPanel: um.put
Java ComboBox in JOptionPane
Java ComboBox in JOptionPane In this section, you will learn how to create combo box in JOptionPane dialog box. We have created a button to perform an action.On clicking the button, you will get the dialog box with combo box in it. 
validation files
validation files  If I place validation files in the folder where the action classes are present,will there any error arise
javascript validation
javascript validation  validation of comparing dropdownlist and textbox in javascript
NSURL Validation
NSURL Validation  How to validate a NSURL string using special character validation
form validation
form validation  how the form validation is done in jsf form using javaScript
validation query
validation query  where I should kept properties file inside struts Web application
Validation - Struts
Validation  what is the best way to use validation in Struts?either "validation.xml" or JavaScript
Display JList value selected from the JOptionPane
Display JList value selected from the JOptionPane In this section, we are going to select the particular value from the JOptionPane combobox and displayed.... To proceed further, when the user click the button, the JOptionPane with combobox
Validation of datepicker
Validation of datepicker  I have a datepicker in my JSp...the seleted dates are put in a text box. I want the alert the user from selecting future... a future date is entered..How to do this validation in javascript or jsp
email validation
email validation  during email validation.... after domain name which it means if example example@gmail.co .... this address allowed by any validation program .... but i want to show invalid email address because domain name com
email validation
email validation  during email validation.... after domain name which it means if example example@gmail.co .... this address allowed by any validation program .... but i want to show invalid email address because domain name com
 

 

 

DMCA.com