Home Answers Viewqa Java-Beginners set text field appearance to default

 
 


Horacio Giovine
set text field appearance to default
1 Answer(s)      3 years and 6 months ago
Posted in : Java Beginners

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 Pages:
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
JButton Appearance
Java: JButton Appearance You don't have to do anything special with a button, but there are many methods for changing the appearance. You can change the alignment of the text and icon, set the font, have
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 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
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
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
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
text field
text field  How to retrieve data from text field   Hi Friend, Try the following code: import java.awt.*; import javax.swing.*; import java.awt.event.*; class RetrieveDataFromTextFields{ public static void main
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
SQL Alter Column Default Value
)) and set the default value for this field is set '10'.Whenever you leave a blank value in Stu_Id, This field would take default value of '10... is used with Create Table Statement. The default value will be set as per
Java Password Field
of text field which allows to enter password only. Due to the security reason... the wrong entry in either of the text field or password field and then if you...Java Password Field In this section we will discuss how to use password field
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 SELECT CONVERT(TEXT,fld_name) FROM TABLE_NAME
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. Thanks
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
Mysql Alter Column Default
' and add column to set default: The Query Alter is used to modify table 'usertable... +------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra... Mysql Alter Column Default     
pdf default size
pdf default size       In this program we are going to tell you how we can automatically set the default size of pdf. Its options are from A0 to A10. These text explains the ISO
Digit Only text field
Digit Only text field  How should we accept digits only in a textbox? (using JSTL only, without Javascript
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
SQL Alter Column Default Value
)) and set the default value for this field is set '10'.Whenever you leave... with Create Table Statement. The default value will be set as per specified... +-----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra
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.
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
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.
Showing the Frame with Default Look and Feel
the frame in the default look and feel. Displayed frame has a combo box and a text box, the text box text is changed as per your selection in the combo box. Screen... Showing the Frame with Default Look and Feel   
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
iPhone Input Field, iPhone Input Field Tutorial
the users.  In iPhone application we can use Text Field to take the input.  Text field displays editable text and once you taps it'll display a keyboard.... And now place labels and Text Field according to your requirement. I have taken
Set TextField Appearance in java Swing
Set TextField Appearance in java Swing In this section, we are going to change the border color of the textbox. For this purpose, we have allowed the user..., the color of the textbox border will changed to red. To set the border color, we have
Text Field in HTML
Text Field in HTML       The Text Field in HTML are one line areas, which enable the user... Text Field in HTML.In this Tutorial, the code create a text field in HTML page
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. ... as a parameter for the method to set it as a default locale. Here is the code
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
Mysql Time Field
,  `time_field` time default NULL,  PRIMARY... Mysql Time Field       Mysql TimeField Query is performed  when you want to return the time field
ipad default image names
ipad default image names  i have a problem while launching application in iPad. The Default image that i have set is not displaying in landscape mode correctly. please suggest. Thanks.   ipad Default image names
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
To make toggle by default hidden
To make toggle by default hidden  i have done this coding in javascript. <script type="text/javascript"> $(document).ready(function...;a href='#' id="pw1">Comments</a> <p id=1></p> by default
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
Browse Button Enlarge Field - Development process
Browse Button Enlarge Field  How can I enlarge the browse text field... of the path is visible in the text box unless you press the end buton on the keyboard to view the remainder of the path. I want to enlarge the field so I can see more
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..  
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
change appearance of alert box
change appearance of alert box  how to change the appearance of an alert() box
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...("Panel.background", Color.yellow); JOptionPane.showMessageDialog(null,"Hello","Set Color
Unique field
Unique field  I have created a form where I have a textbox and a button. When I write something in the textbox and click on submit,it should go to database but at the same time, it should give an alert if the text entered
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...;/form> Text Fields: Text fields are used to allow
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
Select DropDown Default
style="color:red; text-align: center">Report Table</h1> <br>
SET Syntax
or ROLLBACK for canceling it. By default it is set to 1. Example :  ..._LOG_BIN = {0 | 1}  Its default value is 1 but if it is set to 1...}  Its default value is 0 but if it set to 1 then no logging is done
Password Field in HTML
displays asterisks or bullets instead of the characters. Password text field is same as text field. The only difference between them is that when a user entered... illustrates a username and password text field. <form action> :The page
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.