i have a feild where the user must insert only integer values not chars..if they insert a char an error messege should appear..how can i do this and what is the code to do it
shapeshifter
0
Newbie Poster
Recommended Answers
Jump to PostYou can test this using a loop which goes through the numbers:
"0123456789"
If this condition is valid then proceed to the next part of the program. For this you can use a key listener.
Jump to Postactually how do i write the code..i dont know anything abt keylister i am a newbie for java
can u give me a sample codeSomething like this?
KeyView.java
import javax.swing.*; import java.awt.event.*; import java.awt.*; class KeyView extends JFrame implements KeyListener { JTextField keyText = new …
All 6 Replies

iamthwee
shapeshifter
0
Newbie Poster

iamthwee
Phaelax
52
Practically a Posting Shark
b2daj
0
Newbie Poster
jennifer_netto
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.