How to store the text Inputted in JTextArea
I have created a JtextArea using Applets. I wanted to know how we get the text from that area and store it in a datastructure?..please help me
String text = textarea.getText();
Similar Messages
-
How to get the text present in JTextArea
i am writing application for some system to be computerised and i am not getting how to get the text present in text area and set it into database...can anybody suggest me solution??
You must have named the TextArea like
JTextArea textArea;so, use the getText() method like
String strTextAreaContents = textArea.getText();You can then use JDBC to connect to the database that you want and save your contents that is now in strTextAreaContents.
-- Srikanth -
How to wrap the text in a jTextArea
Hello all,
I am currently developing a simple simulation program for our scientific research group. My boss asked me to employ the program with a GUI. However, I am new to Java Swing. It is nice to have you guys that may provide a helping hand to my problem.
My problem is with the jTextArea. Because my result to be displayed in jTextArea is lengthy and its length varies. The way I extract the result is to use a String to hold all of the results and directly pass it to the jTextArea. However, It is lope-sided and not quite user-friendly. Is there any function that I can use so that the text can be wrapped and that the user doesn't need to scroll left or right to view the results?
Thanks in advance(:
Message was edited by:
Shahn
Message was edited by:
Shahnam currently developing a simple simulation program for our scientific
research group. My boss asked me to employ the program with a GUI.
However, I am new to Java Swing. It is nice to have you guys that may provide
a helping hand to my problem.something is amiss.
you're a developer (new to swing is irrelevant) and you don't know how to read the api docs?
there are only 6 set...() methods (apart from inherited) and what you want is 2 of them. -
How a text message came to me can be forwarded to another contact? Is there any facility in iPhone 4 to store the text messages in different folders as can be done in other smartphones?
YOu hold down on the text message until you see copy/more - select more - you'll see the options.
-
How to adjust the text in input field
Hi Expert,
New in VC development. Can someone guide how to adjust the text in input field? Because of long text length it is not displaying fully in visual composer iView so user are not able to see the entire text in input fieldsHI Kundan,
I assume that you have already tried different options perent in Label Postion for the field.
If none of these options meet your requirement then you can try the following workaround:
In the display properties, select label position as no label.
In the form view add a new UI Control for Plain Text or HTML text and change its Label to "Material Number".
Now place this new UI Control in before your actual Input field such that it appears as the field label.
Hope this helps.
Regards,
Rk -
How to store a text file in a hash table in C#?
I am fairly new to c#. I am creating a console application project for practice. I am supposed to create a program that reads a text file (it's a poem), store it in a hash table, have two different sorts, and unhash the table. I managed to get the poem read
by using streamwriter, but now I am not sure how to store it in a hash table.
I'm not sure if I am doing this hash table correct, but I made my hash table like this to store the text file:
Hashtable hashtable = new Hashtable();
hashtable[1] = (@"C:\\Documents\\Datastructures\\Input\\Poem");Hi,
Hashtable in C# represents a collection of key/value pairs which maps keys to value. Any non-null object can be used as a key but a value can. We can retrieve items from hashTable to provide the key . Both keys and values are Objects.
Here is a sample about Hashtable,
Hashtable weeks = new Hashtable();
weeks.Add("1", "SunDay");
weeks.Add("2", "MonDay");
weeks.Add("3", "TueDay");
weeks.Add("4", "WedDay");
weeks.Add("5", "ThuDay");
weeks.Add("6", "FriDay");
weeks.Add("7", "SatDay");
//Display a single Item
MessageBox.Show(weeks["5"].ToString());
//Search an Item
if (weeks.ContainsValue("TueDay"))
MessageBox.Show("Find");
else
MessageBox.Show("Not find");
//remove an Item
weeks.Remove("3");
//Display all key value pairs
foreach (DictionaryEntry day in weeks)
MessageBox.Show(day.Key + " - " + day.Value);
>>I managed to get the poem read by using streamwriter, but now I am not sure how to store it in a hash table
Hashtable hashtable = new Hashtable();
hashtable[1] = (@"C:\\Documents\\Datastructures\\Input\\Poem");
But follow your scenario above, you just store a string path to hashtable not a file.
About saving data to a file, you can use the following code.
// Write the string to a file.
System.IO.StreamWriter file = new System.IO.StreamWriter("c:\\test.txt");
file.WriteLine(lines);
file.Close();
Best wishes!
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Did you know how to link the text in two or more text boxes?
Did anyone know how to link the text in two or more text boxes in Pages 5.0? Thanks for your answer.
Qualcuno sa come collegare il testo in due o più caselle di testo nella versione 5.0 di Pages. Grazie per le vostre risposte.It's just one of the many, many features that have been eliminated or changed. Leave feedback for the Pages team using the link in the Pages menu and review & rate the new versions in the Mac App Store.
If you previously had iWork '09, those apps are still in your Applications folder in a folder named iWork '09. You can continue to use them to get things done. -
How to clear the text in the Text Editor
Hi all,
I created a Text editor and also i am having language field in the screen.
whenever i change the language auomatically the text has to change when the text exists for that
language.
this is working fine, but when the Text exist , the text editor should be blank.
But it is carrying the Previous editor text itself into it .
How to clear the text in the Editor.
Regards,
MadhaviHello Madhavi
The simple report ZUS_SDN_TEXTEDIT_CONTROL shows how to switch the texteditor contents when changing the language.
*& Report ZUS_SDN_TEXTEDIT_CONTROL
*& Thread: how to clear the text in the Text Editor
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1145272"></a>
*& By default the itab GT_OUTTAB contains texts in DE and EN.
*& To switch the language directly enter into the command window:
*& LANGU=DE, LANGU=EN or LANGU=FR
REPORT zus_sdn_textedit_control.
TYPE-POOLS: abap.
TYPES: ty_t_text TYPE TABLE OF as4text
WITH DEFAULT KEY.
TYPES: BEGIN OF ty_s_outtab.
TYPES: language TYPE spras.
TYPES: text TYPE ty_t_text.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
DATA: gt_outtab TYPE ty_t_outtab,
gs_outtab TYPE ty_s_outtab.
DATA: gd_language TYPE spras.
DATA: go_docking TYPE REF TO cl_gui_docking_container,
go_textedit TYPE REF TO cl_gui_textedit.
DATA: gd_okcode TYPE ui_func,
gd_repid TYPE syst-repid.
START-OF-SELECTION.
PERFORM fill_texts.
gd_language = syst-langu.
PERFORM init_controls.
* Link the docking container to the target dynpro
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM set_text_editor.
* NOTE: dynpro does not contain any elements
" ok-code => GD_OKCODE
CALL SCREEN '0100'.
* Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
TRANSLATE gd_okcode TO UPPER CASE.
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'LANGU=DE' OR
'LANGU=EN' OR
'LANGU=FR'.
PERFORM get_text_editor.
SPLIT gd_okcode AT '=' INTO gd_okcode gd_language.
PERFORM set_text_editor.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form FILL_TEXTS
* text
* --> p1 text
* <-- p2 text
FORM fill_texts .
* define local data
DATA: ld_string TYPE string.
gs_outtab-language = 'EN'. REFRESH: gs_outtab-text.
ld_string = 'Good morning'.
APPEND ld_string TO gs_outtab-text.
APPEND gs_outtab TO gt_outtab.
gs_outtab-language = 'DE'. REFRESH: gs_outtab-text.
ld_string = 'Guten Morgen'.
APPEND ld_string TO gs_outtab-text.
APPEND gs_outtab TO gt_outtab.
gs_outtab-language = 'FR'. REFRESH: gs_outtab-text.
ld_string = space.
APPEND ld_string TO gs_outtab-text.
APPEND gs_outtab TO gt_outtab.
ENDFORM. " FILL_TEXTS
*& Form INIT_CONTROLS
* text
* --> p1 text
* <-- p2 text
FORM init_controls .
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
* repid =
* dynnr =
* side = dock_at_left
* extension = 50
* style =
* lifetime = lifetime_default
* caption =
* metric = 0
ratio = 90
* no_autodef_progid_dynnr =
* name =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_textedit
EXPORTING
* max_number_chars =
* style = 0
* wordwrap_mode = wordwrap_at_windowborder
* wordwrap_position = -1
* wordwrap_to_linebreak_mode = false
* filedrop_mode = dropfile_event_off
parent = go_docking
* lifetime =
* name =
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " INIT_CONTROLS
*& Form SET_TEXT_EDITOR
* text
* --> p1 text
* <-- p2 text
FORM set_text_editor .
BREAK-POINT.
CLEAR: gs_outtab.
READ TABLE gt_outtab INTO gs_outtab
WITH KEY language = gd_language.
CALL METHOD go_textedit->set_text_as_stream
EXPORTING
text = gs_outtab-text
EXCEPTIONS
error_dp = 1
error_dp_create = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " SET_TEXT_EDITOR
*& Form GET_TEXT_EDITOR
* text
* --> p1 text
* <-- p2 text
FORM get_text_editor .
CLEAR: gs_outtab.
CALL METHOD go_textedit->get_text_as_stream
EXPORTING
only_when_modified = cl_gui_textedit=>true
IMPORTING
text = gs_outtab-text
* is_modified =
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
MODIFY gt_outtab FROM gs_outtab
TRANSPORTING text
WHERE ( language = gd_language ).
ENDFORM. " GET_TEXT_EDITOR
Regards
Uwe -
How to pull the text for InfoObject in APD
Hi All,
I have a requirement where in I have to combine the data from 2 InfoObjects using an APD based on some conditions.
I need to bring in the text for these infoObjects and there attributes too.
The proposed solution from my side for pulling the text is
u2022 Getting the text from the text table u2013 this is working fine but the performance is not good.
u2022 Making a query above the object and taking the output as the APD input. Now, in the query , I have selected the display option u2018key and textu2019 but when I am using this query as input for the APD, I am not getting the text.
Please let me know how to get the text using the query output and/ or are there any other approach to get the text of an infoObject.
Thanks & Regards
AbhiHi,
It is possible to read the text tables of the infobject, for eg In material you can use table /BI0/TMATERIAL
You have to select a Datasource as the 'Database table and use /BI0/TMATERIAL as one of the underlying tables and then choose another datasource with /BI0/MMATERIAL as the underlying table.
Now that you have all the data that is needed you can use the join to connect the above two datasources .Select the join condition (material in this case) and the fields that you would like to be have to the next level from the individual tables that you have selected earlier.
I guess if you work in this way you might get the results that you are looking forward quite easily without writting code.
Let me know if it helps.
Regards
Ankit -
How to populate the TEXT field in MIGO
Hi folks,
While creating material document in MIGO or MB01, i am inserting some data in TEXT ( Field in line item level ). This text data is disappearing , once mat doc is created.
how to populate the TEXT field in MIGO?Is there any cusomisation?it's urgent .
Regards
pabiHello Pabitra,
I had a similar issue in my Project.
Please verify if the SMOD enhancement MBCF0002 (EXIT_SAPMM07M_001) is active in your system.
If this is the case, verify from two angles:
a) Whether the Enhancement was accidentally activated - If yes, then De-activate the same
b) If there is some logic coded in the User Exit, but, the Text is somehow not determined...even the existing content in the text field (input to EXIT_SAPMM07M_001) will get vanished.
Hope that your problem will be resolved by this. Pls reward points.
With Regards
Vijay Gajavalli -
How to Edit the Text in Flash?
Hi there,
I want to know that how to change the text on the Flash
(.Fla)
I have .Fla and want to edit it with the step by step help.
Currently, I want to edit the text on the home page.
http://www.mtkinetics.com/ayc/index.html
Any help will be highly appreciated.
Regards
bushib1. click on the text. in the properties panel it will say
static text, dynamic text or input text.
2. if it's static text, click on the text tool and click
inside your text. then edit. if it's not static text, you can do
the same thing, but the text will be changed by actionscript during
run-time IF text was originally assigned by actionscript. -
How to get the content of a jTextArea?
hi everyone
can some body provide me with some help???
I want to know how to get the content of a jTextArea
it may be a String and i want to use that String to make some applications
I've use this :
String ch=jTextArea.getSelectedText()
but i'm not sure it will work and i'm not sure it will take the text writen inside the jTextArea ... please help
Thankshttp://forum.java.sun.com/thread.jspa?threadID=778988&tstart=0
-
How to store the datas in a .txt file in to a JTable in Java Swing
Hi sir,
Here i want to know how to store the data's of a .txt file
in to a JTable in java swing.
Where here the .txt file like for eg,spooler.txt is in the server and from there it will come to my client machine what i have to do is to take that .txt file and store the datas of the .txt file
in a JTable.This is what i want.So pls. do help and provide the code as well.I will be thankful.Since i am involved in a project which involves this it is Urgent.
Thanx,
m.ananthuYou can't just display data from a text file in a JTable. You have you understand the structure of the data so that you can parse the data and create a table model that can access the data in a row/column format. Here is an example of a simple program that does this:
http://forum.java.sun.com/thread.jsp?forum=57&thread=315172 -
I want to know how to clear the text area by the push off my next question button and ask a new ques
I want to know how to clear the text area by the push off my next question button and ask a new question - also I want to know how to code in my project to where a user can enter a math question in one border container and the answer enters into the next container
heres my code so far
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" backgroundColor="#1E5C75">
<fx:Script>
<![CDATA[
protected function button1_clickHandler(event:MouseEvent):void
//convert text area into labelid to be identified by actionscript
richTextLabel.text = myArea.text;
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<!--container 1-->
<s:BorderContainer borderWeight="7" x="28" y="10" width="200" height="138">
<s:layout>
<s:VerticalLayout paddingTop="10" paddingBottom="10"
paddingLeft="10" paddingRight="10"/>
</s:layout>
<!--data Entry control-->
<s:TextArea id="myArea" width="153" height="68"/>
<!--end of data entry control-->
<s:Button width="151" label="ask a question" click="button1_clickHandler(event)"/>
</s:BorderContainer>
<!--container2-->
<s:BorderContainer borderWeight="7" x="509" y="10" width="200" height="138">
<s:layout>
<s:VerticalLayout paddingTop="10" paddingBottom="10"
paddingLeft="10" paddingRight="10"/>
</s:layout>
<!--data entry control-->
<!--convert tne data entry control into a label id in actionscript-->
<s:Label id="richTextLabel" width="153" height="68"/>
<s:Button width="151" label="next question" click="button1_clickHandler(event)"/>
</s:BorderContainer>
</s:Application>This is a user to user support forum. We are all iphone users just like you.
You are not addressing Apple here at all.
This is an odd way to ask your fellow iphone users for help. Berating oterh users will not help you.
"it's too fragile"
No it is not. i have never damaged one, nor has anyone I know.
" U loose data when Ur phone is locked"
No you don't. Why do you think this?
"and there is no customer support!!! "
Wrong yet again. Apple has an 800 number and they have many retail stores and they have support articles that you can access using the search bar. Or you can contact them throgh express lane online
"but I will go back with Blackberry "
Please do.
Good ridance -
How to print the text in points wise in sap script
hi friends,
how to print the text in points wise in sap script.
ex: if suppose paragraph consists of 15 lines. then according to one sentence or one fullstop (.) it should give point 1. like that...
1. hai how ru.
2. what r u doing.
3.where r u.
like this i want numbering.. waiting for ur replys.
thanks,
kirandeclare a counter
data : cnt type char 4.
print :
cnt = cnt + 1.
&cnt& &text&
cnt = cnt + 1. and so on.
or.
if the data is in an internal table
loop at internal_table.
cnt = cnt + 1.
write form.
in script -&cnt& &text&
endloop.
Edited by: NIKHILKUMAR POOJARI on Nov 17, 2008 11:18 AM
Maybe you are looking for
-
SAP BOBJ connection with SQL server 2008
HI Gurus I want to install bobj server on a server that already have SQL server 2008 installed on it, I have few confusions as this is my first time installation, I hope you can help me. 1. Since SQL server is installed on the same machine where I ha
-
Why would I want to change JPEG quality of photos when exporting them from iPhoto?
Why would I want to change JPEG quality of photos when exporting them from iPhoto? Changing the quality of the print changes the size of the saved file and thus impacts the speed at which it is moved on the internet. But other than size of the file
-
HU in multiple storage location
Can HU resided in multiple storage location?? I'd like to know if it's possible to transfer partial qty of an HU into multiple storage location with the same plant/whse. Here is the scenario: HU1234 has 100pcs in plant ABC 0001 whse 011 bin aa-001-c
-
Transfer iTunes environment (including ratings and last played)
I want to use iTunes on a different computer to access my current music library, but I want to preserve my ratings, last time played, etc. I have seen earlier posts about transfering music library, but they don't preserve the environment. Doing it ma
-
Command key not working right in several applications
All of a sudden, some functions are not working right, i.e., in PhotoShop when I select the Zoom key I get a minus rather than the usual plus. In Date and Time, I started getting a 24 hour clock. If I go there in System Prefs and change to 24 hour cl