set text field appearance to default

set text field appearance to default

View Answers

December 1, 2009 at 2:59 PM

Hi Friend,

Try the following code:

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.regex.*;

public class TextFieldBorderColor extends JFrame{
JTextField text1,text2;
JLabel label1,label2;
JPanel panel;
JButton b;
public TextFieldBorderColor(){
label1=new JLabel("Enter Name");
text1=new JTextField(10);
b=new JButton("Submit");
panel=new JPanel(new GridLayout(2,2));
panel.add(label1);
panel.add(text1);
panel.add(b);
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
String value1=text1.getText();
Pattern p = Pattern.compile("[0-9]");
Matcher m = p.matcher(value1);
if (m.find()) {
text1.setBorder(BorderFactory.createLineBorder(Color.red));
}
}
});
add(panel);
setVisible(true);
pack();
}
public static void main(String[] args) {
TextFieldBorderColor color=new TextFieldBorderColor();
}
}
Thanks









Related Tutorials/Questions & Answers:
set text field appearance to default - Java Beginners
set text field appearance to default  hi, i am doing a program... color of a text box if the input was incorrect, but when i fail to set... is wrong, i set the border to red, if not, i want to leave it default, but i cant
is set interface synchronize by default???????
is set interface synchronize by default???????  is set interface synchronize by default??????? an whether list is syncrhronized by default
Advertisements
iPhone Text Field Border 
Text Field Boarder  In this tutorial will learn about the text field Boarder, we can set the boarder of text field by selecting the text field... field and will set create a variable for the text field, after creating
text field
text field  How to retrieve data from text field   Hi Friend, Try the following code:ADS_TO_REPLACE_1 import java.awt.*; import javax.swing.*; import java.awt.event.*; class RetrieveDataFromTextFields{ public
Text field save as word file
Text field save as word file  Dear experts At run how to save set of text field contains text into single Word file. To save in our desktop computer. Solve my problem
converting field to text sql
converting field to text sql  I wanted to convert the field to TEXT in SQL.. is it possible?   SQL - Converting the field to TEXT works... the field to TEXT works (adsbygoogle = window.adsbygoogle || []).push
jsf text field not blank
jsf text field not blank  text field not clear in jsf onclick of reset button in my application initial value not deleted   Hello Friend, Post your code. (adsbygoogle = window.adsbygoogle || []).push
validate text field iPhone
validate text field iPhone  i got two different UITextfield in my iPhone application for user login. Just wondering how to validate
CALULATION IN TEXT FIELD
CALULATION IN TEXT FIELD  Suppose 3 text Field first amount ,second amount and third sum of these amount,this amount will appear when tab in next filed(i don't want use any type button) in java swing HOW? PLEASE HELP
swing text field problem
swing text field problem  I want to navigate the content of text field from one class to another and viceversa through button but when I am getting the text from first class I am getting null value.please help me..here
swing text field problem
swing text field problem  I want to navigate the content of text field from one class to another and viceversa through button but when I am getting the text from first class I am getting null value.please help me..here
Digit Only text field
Digit Only text field  How should we accept digits only in a textbox? (using JSTL only, without Javascript
rich text field - JSP-Servlet
rich text field  Hi, this is jawahar. my question i need rich text field in my program . plz send me the code
clearing text field in spring form
clearing text field in spring form  hi, I have spring form in that i have security question dropdown field and security answer text field ,when i submitted form with errors the answers text field value should be clear, for this i
How to assign a default value to text box in netbeans
How to assign a default value to text box in netbeans  I have a java application,and i want to assign a default variable to the textbox
Java Set Default Locale
Java Set Default Locale       Setting Default Locale Example in Java Locale can be set also.... In this example we have set the default locale value of our Locale with the Locale.ITALY.ADS
Set text color in JoptionPane
Set text color in JoptionPane In this section, you will learn how to set text... is responsible for look and feel. Using following key value pair, we have set the text... we have explained you how to Set text color in JoptionPane
text field validation - Java Beginners
text field validation  hi How to validate allow only decimal number in text box in jsp?  Hi Friend, Try the following code: function isDecimal(str){ if(isNaN(str) || str.indexOf(".")<0){ alert
Text Field in HTML
Text Field in HTML       The Text Field in HTML are one line areas, which enable the user... an example from Text Field in HTML.In this Tutorial, the code create a text
focus text field - Swing AWT
focus text field  i want to move cursor to next text field...(java.awt.event.KeyEvent evt) { Set..._TRAVERSAL_KEYS); Set newForwardKeys = new HashSet(forwardKeys
ModuleNotFoundError: No module named 'django-storage-text-field'
ModuleNotFoundError: No module named 'django-storage-text-field'  Hi...: No module named 'django-storage-text-field' How to remove the ModuleNotFoundError: No module named 'django-storage-text-field' error? Thanks  
ModuleNotFoundError: No module named 'django-short-text-field'
ModuleNotFoundError: No module named 'django-short-text-field'  Hi...: No module named 'django-short-text-field' How to remove the ModuleNotFoundError: No module named 'django-short-text-field' error? Thanks   
ModuleNotFoundError: No module named 'django-storage-text-field'
ModuleNotFoundError: No module named 'django-storage-text-field'  Hi...: No module named 'django-storage-text-field' How to remove the ModuleNotFoundError: No module named 'django-storage-text-field' error? Thanks  
focus text field - Swing AWT
focus text field  i want to move cursor to next text field...(java.awt.event.KeyEvent evt) { Set..._TRAVERSAL_KEYS); Set newForwardKeys = new HashSet(forwardKeys
date_default_timezone_set
  date_default_timezone_set date_default_timezone_set function sets... bool date_default_timezone_set ( string $timezone_identifier ) It is notable that default timezone can also be set by using INI setting date.timezone.
Can i insert image into struts text field
Can i insert image into struts text field  please tell me can i insert image into text field
regarding out put display in html text field
regarding out put display in html text field  how to dispaly the output coming from servlet in a particular text field of html
JSP combo and text field related questio
JSP combo and text field related questio  in JSP,i had stored data from database in a textboxes usin combo..now i want to use these values of text... and name given to that text field..but its showing somethimng null pointer exception
How to Define Text Field Validation iPhone
How to Define Text Field Validation iPhone  Hi, Can anybody explain me how to define textfield validation iPhone program. please phone online help reference or example. Thanks
How to set UILabel text size, color etc.. in XCode
How to set UILabel text size, color etc.. in XCode  How to set UILabel text size (height), color etc.. in XCode
retrive record from the text field and insert into to database
retrive record from the text field and insert into to database  ... ServletException,IOException{ response.setContentType("text/html... =new ArrayList(); String query = "insert into LTCINFO.PERSONS set
change appearance of alert box
change appearance of alert box  how to change the appearance of an alert() box
fetch values from database into text field
fetch values from database into text field  please provide the example for fetching values from database into text field of table as if i am... "rs.getString" in the text field also..   import java.awt.*; import
fetch values from database into text field
fetch values from database into text field  please provide the example for fetching values from database into text field of table wth edit...;/td>"); the i am getting "rs.getString" in the text field also..  
iPhone Text Field Validation
iPhone Text Field Validation In any user based application "... data from user. In this tutorial we are going to limiting the text field input...;. We have also take a Text field on the view to take the input from user
Write an applet program to transfer the content of the text field into the component on clicking a button
Write an applet program to transfer the content of the text field into the component on clicking a button  Write an applet program to transfer the content of the text field into the component on clicking a button
Use of Text Field
Use of Text Field, Text box, Text Area, Checkbox,Dropdownlist and Radio... types of information. A form contains form elements checkbox, text field, radio...;input> </form> Text Fields: Text fields
org.webjars.bowergithub.vaadin - vaadin-text-field version 2.3.0-alpha6 Maven dependency. How to use vaadin-text-field version 2.3.0-alpha6 in pom.xml?
; - Version 2.3.0-alpha6 of vaadin-text-field in pom.xml? How to use vaadin-text-field... 2.3.0-alpha6 of vaadin-text-field in project by the help of adding the dependency.... The developers of   org.webjars.bowergithub.vaadin - vaadin-text-field
org.webjars.bowergithub.vaadin - vaadin-text-field version 2.4.10 Maven dependency. How to use vaadin-text-field version 2.4.10 in pom.xml?
org.webjars.bowergithub.vaadin  - Version 2.4.10 of vaadin-text-field... 2.4.10 of vaadin-text-field in pom.xml? How to use vaadin-text-field version...; org.webjars.bowergithub.vaadin - vaadin-text-field project have released
org.webjars.bowergithub.vaadin - vaadin-text-field version 2.3.10 Maven dependency. How to use vaadin-text-field version 2.3.10 in pom.xml?
org.webjars.bowergithub.vaadin  - Version 2.3.10 of vaadin-text-field... 2.3.10 of vaadin-text-field in pom.xml? How to use vaadin-text-field version...; org.webjars.bowergithub.vaadin - vaadin-text-field project have released
org.webjars.bowergithub.vaadin - vaadin-text-field version 2.3.7 Maven dependency. How to use vaadin-text-field version 2.3.7 in pom.xml?
org.webjars.bowergithub.vaadin  - Version 2.3.7 of vaadin-text-field... 2.3.7 of vaadin-text-field in pom.xml? How to use vaadin-text-field version 2.3.7...; org.webjars.bowergithub.vaadin - vaadin-text-field project have released the latest
Retrive data from databse to a text field - Java Server Faces Questions
Retrive data from databse to a text field  Hi, Can you give me a source code to rertrve data from Mysql databse to a text field using JSF.....by selecting option from a dropdown option
Text Field Midlet Example
Text Field MIDlet Example       This example illustrates how to insert text field in your form... the form with name and company field. The TextField
I need jsp code for how to write text field value into property file.
I need jsp code for how to write text field value into property file.  Hi , I need to set the text field value into property file using jsp code. Example : Username : Valar , I have entered the value "Valar" in the text field
Maven Repository/Dependency: org.webjars.bowergithub.vaadin | vaadin-text-field
Maven Repository/Dependency of Group ID org.webjars.bowergithub.vaadin and Artifact ID vaadin-text-field. Latest version of org.webjars.bowergithub.vaadin:vaadin-text-field dependencies. # Version Release
Fetched Record from database show into text field of html page
Fetched Record from database show into text field of html page  hi, i have a database with field merchant_code, merchant_name, city, region... in the text field of merchant name then suggest all merchant name in the form
com.vaadin - vaadin-text-field-flow version 2.0.1 Maven dependency. How to use vaadin-text-field-flow version 2.0.1 in pom.xml?
com.vaadin  - Version 2.0.1 of vaadin-text-field-flow Maven dependency? How to use  com.vaadin  - Version 2.0.1 of vaadin-text-field-flow in pom.xml? How to use vaadin-text-field-flow version 2.0.1 in pom.xml? Learn to use
Setting the default Locale
;  This section shows you how to set the default locale. Example presented in the section, illustrates you how to get and set the default locale. ... takes a locale as a parameter for the method to set it as a default locale. Here
javascript cal code for selecting date in text field - JSP-Servlet
javascript cal code for selecting date in text field  HI I want javascript calendar code to select date in text field in jsp.pls send me?  Hi Friend, Please visit the following links: http://www.roseindia.net
Show text field & check input using jQuery
Show text field & check input using jQuery In this tutorial, we will discuss about how to display 'text field' by a button click & check... how to display 'text field' by a button click & check input using

Ads