Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML

Fresher Job


 

Search Host

Monthly Fee($)
Disk Space (MB)
Register With us for Newsletter!
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
roseindia_net@yahoo.com
 
   

Tutorials

Java Server Pages

JAXB

Java Beans

JDBC

MySQL

Java Servlets

Struts

Bioinformatics

Java Code Examples

Interview Questions

 
Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Web Promotion

Web Submission

Submit Sites

Manual Submission?

Web Promotion Guide

Hosting Companies

Web Hosting Guide

Web Hosting

Linux

Beginner Guide to Linux Server

Frameworks

Persistence Framework

Web Frameworks

Free EAI Tools

Web Servers

Aspect Oriented Programming

Free Proxy Servers

Softwares

Adware & Spyware Remover

Open Source Softwares

java swings
Expert:valarmathi
Hi,

This is my code.
How can i set the jtextfield validation in numeric value only.
Please change the code.If i insert otherthan number it displays error message.

package com.zsl.ibm.mqtool;

import java.awt.Color;
import java.awt.Font;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.UIManager;

class OSInformation extends JPanel {
/**
*
*/
private static final long serialVersionUID = 752052456706205768L;

public OSInformation() {


JLabel osname, osversion, osarchitecture, javapathname, javalibrarypath, javatemppath,ostitlelabel;

JTextField osnametext, ostextversion, ostextarch, javatextpath, javatextlibrary, javatemptextpath;
// Fetch icon
Icon icon = new ImageIcon("e:\\logo.gif");

// Create a label with text and an icon; the icon appears to the left of the text
JLabel label = new JLabel("Text Label", icon, JLabel.CENTER);

// Create a label with only an icon
label = new JLabel(icon);


// Add an icon to an existing label
label.setIcon(icon);
add(label);
label.setBounds(0, 0, 150,80);

ostitlelabel =new JLabel("Current Working OS");
ostitlelabel.setFont(new Font("Microsoft Sans Serif", Font.BOLD, 16));
//ostitlelabel.setForeground(Color.MAGENTA);
ostitlelabel.setForeground(Color.decode("#660033"));
osname = new JLabel("OS Name");
osnametext = new JTextField(33);
osnametext.setEditable(false);
String osName = System.getProperty("os.name");
osnametext.setToolTipText("Current Working OS Name");
osnametext.setText(osName);

osname.setFont(new Font("Microsoft Sans Serif", Font.BOLD, 12));

osversion = new JLabel("OS Version");
ostextversion = new JTextField(33);
ostextversion.setEditable(false);
String osVersion = System.getProperty("os.version");
ostextversion.setText(osVersion);
ostextversion.setToolTipText("Current Working OS Version");
osversion.setFont(new Font("Microsoft Sans Serif", Font.BOLD, 12));

osarchitecture = new JLabel("OS Architecture");
ostextarch = new JTextField(33);
ostextarch.setEditable(false);
String osType = System.getProperty("os.arch");
ostextarch.setText(osType);
ostextarch.setToolTipText("Current Working architecture");
osarchitecture.setFont(new Font("Microsoft Sans Serif", Font.BOLD, 12));

javapathname = new JLabel("Java Path");
javatextpath = new JTextField(33);
javatextpath.setToolTipText("Java Installation Path");
javatextpath.setEditable(false);
String jPathName = System.getProperty("java.home");
javatextpath.setText(jPathName);
javapathname.setFont(new Font("Microsoft Sans Serif", Font.BOLD, 12));

javalibrarypath = new JLabel("Java Library Path");
javatextlibrary = new JTextField(33);
javatextlibrary.setEditable(false);
String jlibraryPath = System.getProperty("java.library.path");
javatextlibrary.setText(jlibraryPath);
javatextlibrary.setToolTipText("Java Library Path");
javalibrarypath.setFont(new Font("Microsoft Sans Serif", Font.BOLD, 12));

javatemppath = new JLabel("Java Temp Directory");
javatemptextpath = new JTextField(33);
javatemptextpath.setEditable(false);
String jTempPath = System.getProperty("java.io.tmpdir");
javatemptextpath.setText(jTempPath);
javatemptextpath.setToolTipText("Java Temprary Directory Path");
javatemppath.setFont(new Font("Microsoft Sans Serif", Font.BOLD, 12));


setLayout(null);

add(ostitlelabel);
ostitlelabel.setBounds(190, 40, 170, 20);

add(osname);
add(osnametext);
osname.setBounds(110, 100, 160, 14);
osnametext.setBounds(290, 100, 180, 20);

add(osversion);
add(ostextversion);
osversion.setBounds(110, 140, 160, 14);
ostextversion.setBounds(290, 140, 180, 20);

add(osarchitecture);
add(ostextarch);
osarchitecture.setBounds(110, 180, 180, 14);
ostextarch.setBounds(290, 180, 180, 20);

add(javapathname);
add(javatextpath);
javapathname.setBounds(110, 220, 160, 14);
javatextpath.setBounds(290, 220, 180, 20);

add(javalibrarypath);
add(javatextlibrary);
javalibrarypath.setBounds(110, 260, 160, 14);
javatextlibrary.setBounds(290, 260, 180, 20);

add(javatemppath);
add(javatemptextpath);
javatemppath.setBounds(110, 300, 160, 14);
javatemptextpath.setBounds(290, 300, 180, 20);

setBackground(Color.decode("#99CC99"));

}
}

This is very urgent.


Thanks,
Valarmathi
Answers
More Questions
Post Answers
 
Ask Question Facing Programming Problem?
Useful Links
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.