473,581 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ReadOnly JTextField

176 New Member
Hello guys. I was wondering if it is possible to make a JTextField read only. In a program I am writing I don't want the user to be able to edit the text in a JTextField.
Jun 4 '08 #1
3 10743
849 Recognized Expert Contributor
Look at the API for JTextComponent and JTextField. There's something like setEditable.
Jun 4 '08 #2
Kid Programmer
176 New Member
Look at the API for JTextComponent and JTextField. There's something like setEditable.
Thanks that worked :-)
Jun 4 '08 #3
11,448 Recognized Expert MVP
Another lesson learned: always read the appropriate API documentation sections
first before you start banging that keyboard; it saves you a lot of time.

kind regards,

Jun 4 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: L L | last post by:
Dear all, Is it possible to set selected item a table row or in other ways, the editable JComboBox 's JTextField- can that be replace by a one row table? If possible, any direction of what methods to implement? Any reference? Thank you.
by: Alexander Mazo | last post by:
Hi! I'm new in JAVA. I'm wont change "Home" and "End", but nothing receive. public class RLTextField { public static String s = new String(); public static void main(String args) { JFrame frame = new JFrame("RigthToLeftTextField"); final JTextField textField = new JTextField(30);
by: oll3i | last post by:
How to make a JTextField disabled after some data has been entered into it? and then make it editable again when a button is clicked?
by: JoeMac3313 | last post by:
The question is how can I update the JTextField in Class CreditDisplayField when I hit the button in class CreditButton? I wrote in a test printing to console to make sure the "logic.addCredits();" in the class ButtonHandler is being done and that works but the "creditDisplay.update();" in the same area still shows 0 and does not update w/ the...
by: all eyes | last post by:
hi all, i am using here JTextField to get sum of all previously pressed numbers in one button called (+) and so on. there is only one button take care of addition and displaying the result in the same JTextFeild, like : 1-press any number, called it 1. 2-press the (+) button to add previous number. 3-press anthor number, called it 5....
by: ahmed222too | last post by:
the jtextfield donot accept Arabic language font when i run this code jtextfield.settext="ذهب الولد إلى المدرسة"; the arabic font change into another font in the jtextfield
by: ahmed222too | last post by:
when i read data from file by code into jtextfield the lines of the file apprear in Concatenation in the jtextfield (without Enters between lines) i want to transfere the content of the file to the jtextfield as it is in the file (with Enters between lines)
by: dig909 | last post by:
I am trying to compare a number inserted into a jtextfield with a number generated with the program. Unfortunately the numbers never evaluate as equal. Here is an example of the code I'm working with. In the example if the user inserts 10 is should come up as equal but it still comes up as false. import java.awt.*; import java.awt.event.*;...
by: jitheshborgia | last post by:
Can anybody help me??? I have created a java page that extends JWindow. But i can't get focus on my JTextfield. The code is shown below import java.awt.*; import javax.swing.*; public class testWindow extends JWindow { JPanel pan; JTextField tf; public testWindow() { pan = new JPanel(); tf = new...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.