473,382 Members | 1,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

i want to transfere the content of the file to the jtextfield as it is in the file

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)
May 25 '08 #1
4 1964
JosAH
11,448 Expert 8TB
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)
A JTextField is a single line text component; i.e. it can't display more than one
line of text. Use a JTextArea instead.

kind regards,

Jos
May 25 '08 #2
BigDaddyLH
1,216 Expert 1GB
By the way, this method is a handy way to read data in a text component: Read method
May 26 '08 #3
JosAH
11,448 Expert 8TB
By the way, this method is a handy way to read data in a text component: Read method
I fell into that trap once: that read method installs a new Document in the
component. If you had just pooped up your JTextComponent with all sorts
of listeners and undoable managers etc. they aren't carried over to the new
Document, i.e. you have to do that yourself after the read has finished.

kind regards,

Jos
May 26 '08 #4
Kid Programmer
176 100+
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)
Listen to the first post by JosAH. Change the code in the imports from:
Expand|Select|Wrap|Line Numbers
  1. import javax.swing.JTextField;
to:
Expand|Select|Wrap|Line Numbers
  1. import javax.swing.JTextArea;
and change the variable declaration to:
Expand|Select|Wrap|Line Numbers
  1. jtextarea = new JTextArea("");
That should do the trick.
May 26 '08 #5

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

Similar topics

0
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...
0
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...
1
oll3i
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?
1
by: Cybelle | last post by:
please anyone can help me to solve this stuff, this is our final ., theres an error and i dont know how to solve it., import java.awt.*; import java.awt.event.*; import java.net.*;...
0
JoeMac3313
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();"...
2
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...
1
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
1
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...
4
by: lilyumestar | last post by:
I have project I have to do for class. We have to write 4 different .java files. Project2.java HouseGUI.java House.java HouseSorting.java I already finish House.java and I need to work on...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.