Input Validation - Jtext Field in Java (Java 2 SE)

This project received 38 bids from talented freelancers with an average bid price of $50 USD.

Get free quotes for a project like this
Employer working
Skills Required
Project Budget
Total Bids
Project Description

I have already a Java application that takes input of students and stores in a .dat file (in rows and columns). The problem that I am facing right now is that in one of the class files (which is used to enter student details), I have a JTextField element that takes the marks of the students. I want only a certain range of number to be entered in the this field, say between 20 and 30 or between 40 and 60 like that....

Currently I am using to implement this input validation using a key event listener but it is not working properly and giving an error : 'invalid character constant' in eclipse IDE. I don't want to use anything else than this key event listener method as it will mess up the whole code. This is the current piece of code that is giving me trouble. If you think you can implement this without affecting or changing the main program, pls PM me with rates.

// input validation that restricts user to enter specific number range
between 20 and 30

[url removed, login to view](new KeyAdapter() {
public void keyTyped(KeyEvent ke) {
char c = [url removed, login to view]();
if(!([url removed, login to view]() >= '20' && [url removed, login to view]() <= '30')) {
[url removed, login to view]();

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online