Moving data string from a jtextarea into an array

i was looking for some advice. how would i be able to take chunks of text on a paragraph by paragraph basis and enter them into an array. which would result in paragraph1 in array 0, and so on. is this possible to do? i have never really used straing arrays before, and if anyone knows of any online tutorials it would be a great help
thank u

here you go, forgive the gui, very sloppy looking, press the Click me button to store the jtextarea data into the array and show output button to see what the value stored in the array is. there are 2 classes:
class MyMain {
      public static void main(String args[]){
          MyMain main = new MyMain();
          main.createIt();
      public void createIt() {
          MyFrame frame = new MyFrame();
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
class MyFrame extends JFrame {
      String[] myString = new String[1];
      JTextArea textArea = new JTextArea();
      JButton myButton = new JButton("Click me");
      JButton outButton = new JButton("Show output");
      MyFrame() {
          myButton.addActionListener(new ButtonListener());
          outButton.addActionListener(new OutListener());
          getContentPane().setLayout(new GridLayout(1,3));
          getContentPane().add(myButton);
          getContentPane().add(textArea);
          getContentPane().add(outButton);
          setVisible(true);
      class ButtonListener implements ActionListener{
          public void actionPerformed(ActionEvent e){
              myString[0] = textArea.getText();
      class OutListener implements ActionListener{
          public void actionPerformed(ActionEvent e) {
              System.out.println(myString[0]);
}

Similar Messages

  • Putting data read from a StreamTokenizer into an array.

    I need to put the data that I have read from a file using a streamtokenizer into an array, so that I can use it later on in my program.
    If anyone can help I would be grateful!!

    Here's a link that should help. It even includes an example:
    http://java.sun.com/docs/books/jls/first_edition/html/javaio.doc14.html

  • How to store the data coming from network analyser into a text or excel file

    Hii everyone
    I'm using Agilent 8719ET network analyser and wish to store the data coming from netowrk analyser into a text file/ excel file.
    Presently I'm able to get the data on Labview graph using GPIB . Can anyone suggest how to go ahead after collect data sub vi. How can the data be stored into a file apart from showing on the graph?
    Attached is the vi for kind consideration...
    Looking for help
    Regards
    Rohit
    Attachments:
    Agilent 87XX Series Exceed Max Meas.vi ‏43 KB

    First let me say that your code really looks pretty good. The data handling could be made more efficient by calculating the number of datapoints that are going to be in the completed dataset and preallocating the entire array -- but depending upon your answer to my questions, the logic in the lower shift register may be going away - so we won't worry about that right now.
    The thing I need to know before addressing the data storage question is: Each time you call "Collect and Display Data.vi", how many element are in the array? Are you reading single data points, or a group of data? (BTW: if the answer to that question is obvious based on the way the other VIs are setup, I don't have the drivers so I can't tell what the setup values are.) Second, how fast does the loop iterate? Are we talking msec per loop?, seconds? fortnights?
    The issues here are two-fold: how much data? and how fast is it coming? The answer to these will tell you how to save the data.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How do I Display a string from a servlet into a JSP Page???? NEED HELP!!!!

    Hi guys,
    How do I Display a string from a servlet into a JSP Page...
    Ive tried so many bloody things!.....
    Simply.
    I get text from JSP. The servlet does what ever it does to the string.
    Now. Ive create sessions and bean things,.... how the hell do I display it in a text box... I can display on the screen.. but not in the text box.!!!
    please help!!!

    hmmm, I dont really like using JSP programming, u should be using JAVA..
    the way to do it is:
    Call and cast to the bean like this:
    <%@ page import="beans.*" %>
    <% //cast to bean get request create object
    userNameBean u= (userNameBean) request.getSession().getAttribute("userNameBean");
    then... all you do is call it like this:
    <input type="text" name="firstName" value="<%= u != null? u.getFirstName(): "" %>">
    this is the real programmers way,,,
    chet.~

  • Reading a flattened LabVIEW data string from a CSV file in C#?

    We're recording a large amount of data into a CSV file to make it easily accessible from the C# end. I've a header with all the variable names then I write all the data (doubles) as flattened LabVIEW binary strings using flatten to string (little endian) to keep the size down. We are having issues converting these strings back to doubles on the C# end.
    At the C# end we can read the LabVIEW repesentation of the DBL but have tried the BitConverter.ToDouble library function to convert it without luck. We use this method to convert the same flattened data coming over a TCP connection without any problems. I'm not writing the C# part of the program and have little experience with it, but if anyone could shed some light, it would be greatly appreciated.
    Regards,
    Andrew

    It is all written as single values. It looks like we have found a method if we remove the header which contains the variable name as a string so the data is in a csv containing just the binary data strings. It looks like we'll go with this as the data will always be written in the same order so can be indexed by the C# program without the need for headers.
    Thanks.

  • Moving data's from collection

    Hi friends,
    I have a APEX form and soon after if i insert via form means, then it will save the details(data's) in the table. But my question is how to move a data from a collection table to a main table. Is there any way of moving the stored data's from the collection to the table.
    Once the data is transferred into the table from collection, the transferred data in the collection has to get deleted. Only the data's which is not transferred to the main table should exist in the collection.
    Once the data is transferred from the collection to the table means, then that transferred data (i.e) row data should not exist in collection..
    Anyways of achieving it friends.
    Brgds,
    Mini

    Dear Jari,
    I have created an example in apex.oracle.com
    http://apex.oracle.com/pls/apex
    Workspace: mini_ws
    Username: [email protected]
    Password: 4i@duppyApplication 11569 - Upload Data File..
    I have two buttons over there..one is Upload and the other one is Upload1
    If u pressed Upload button soon after browsing one csv file with a Separator as ,(comma), then the datas from the .csv file will be saved in the collection..
    And after that if u pressed the Upload1 button means, then the data from the collection will be saved in my custom table named(excel_upload_table).
    What is the problem that im facing here is.
    Suppose if i upload the csv file with an column heading for each column(that is the two column ID, NAME)  means then i couldnt upload the data from collection to my custom table.
    I have two columns in my custom table like
    <li> ID
    <li> Name
    But if i upload the csv file without the column heading for each column(that is the two column ID, NAME) means, then i can upload the data from the collection to the my custom table.
    How i can proceed with this task, so that i can upload the csv file with the column heading for each and every column.
    Brgds,
    Mini

  • Data Managers from all applications into one unique package

    Hi,
    The issue is that we are trying to put all the Data manager packages in all applications into one unique package.
    If BPC admin changes the parameters or currency rates , he just has to run that one package which includes all necessary
    packages and he may look into logs if he has to.
    Firstly , We tried to put multiple run_logic process types into one process chains, but it is giving errors like;
    u201CAn exception with the type CX_SY_TABLE_KEY_SPECIFICATION occurred, but was neither handled locally, nor declared in
    a RAISING clause Line Type Contains a Component with the Name FI_ACCu201D
    or
    u201CAn exception with the type CX_SY_OPEN_SQL_DB occurred, but was neither handled locally, nor declared in a RAISING clause
    The system tried to insert a data record, even though a data record with the same primary key already existsu201D.
    Secondly, after we read the blog () and we tried to run program
    UJD_TEST_PACKAGE , but we get errors with %SELECTION% prompt variable.
    Is there any other solution you can advise?
    If we use the program UJD_TEST_PACKAGE how do we fill AnswerPrompt paremeter file for the dynamic script below?
    PROMPT(SELECTINPUT,,,"Lütfen bir kategori seçiniz.","%CATEGORY_DIM%,%TIME_DIM%")
    PROMPT(TEXT,%LEVEL%,"XX Level",,"7,6,5,4,3,2,1")
    INFO(%EQU%,=)
    INFO(%TAB%,;)
    TASK(XXX_LOGIC,TAB,%TAB%)
    TASK(XXX_LOGIC,EQU,%EQU%)
    TASK(XXX_LOGIC,SUSER,%USER%)
    TASK(XXX_LOGIC,SAPPSET,%APPSET%)
    TASK(XXX_LOGIC,SAPP,MM)
    TASK(XXX_LOGIC,SELECTION,%SELECTION%)
    TASK(XXX_LOGIC,LOGICFILENAME,XXXX.LGF)
    TASK(XXX_LOGIC,REPLACEPARAM,LEVEL%EQU%%LEVEL%)
    Best Regards,
    Melike

    Hi.  I have a similar issue to the one posted below in that I want to run a logic script for one application (call it Application A) from a DM package in a different application (Application B).  This is to stop the user from having to switch between applications to run the logic.
    I have tried the following:
    1. I have tried putting the script logic from App A into App B, but the dimensionality is different so it fails to validate.
    2. I have tried "hard coding" the application name within the process chain, but it fails with an error "u201CAn exception with the type CX_SY_TABLE_KEY_SPECIFICATION occurred ...." similar to the post below.
    Any suggestions would be appreciated.
    Thanks
    Sean

  • Concatenate strings from a column into a single row

    I am trying to string values from a column into a single row. I need a list of students (one row per student) with their phone number and they could have more than one number. I found a function that should do what I need but the syntax is for SQL Server, not SQL*Plus. I've tried several variations but can not come up with the correct syntax.
    This is the SQL Server version:
    CREATE FUNCTION dbo.GetPhoneList(@StudentID int)
    RETURNS varchar(500) AS
    BEGIN
    DECLARE @StringList varchar(500)
    SELECT @StringList = COALESCE(@StringList + ‘, ‘, ”) + Telephone.PhoneNumber
    FROM Telephone t
    WHERE t.StudentID = @StudentID
    IF @StringList IS NULL
    SET @StringList = ‘No Phone’
    RETURN @StringList
    END
    SQL*Plus does not like the @ symbol, so I tried taking that out. I've put semi-colons where I think they should be, but I still get various error messages. Any suggestions?
    Thanks.

    Hi,
    What you want to do is called "String Aggregation"
    You could write a PL/SQL funcrtion to do that for a specific column in a specific table, but [this page|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2196162600402] has a couple of different generic solutions that will work on any tables and columns.
    I recommend the first soluton, the user-defined function STRAGG, which you can copy from that page.
    Once you have STRAGG installed, your query can be something like:
    SELECT     s.student_id
    ,     NVL ( STRAGG (t.phone_number)
             , 'No phone'
             )     AS phone_nums
    FROM          student          s
    LEFT OUTER JOIN     telephone     t     ON s.student_id     = t.student_id
    GROUP BY     s.student_id;On Oracle 10 (and up) you may have a similar function, WM_CONCAT (owned by WMSYS), already installed.
    WM_CONCAT is not documented, so you may not want to use it in your Production applications.
    It lokks like
    Edited by: Frank Kulash on Feb 10, 2009 6:31 PM

  • Data loading from flat file into bw

    Hi Experts,
    When we load data from flat file into BW the <b>sequence of fields in flat file</b> should be matched with the <b>transfer structure</b> or <b>communication structure</b>?
    wid thanX,
    arijit

    Arijit,
    The sequence of fields in a flat file must be the same as this one in the transfer structure.
    The comm and tran structures are the same after the first creation of datasource from flat file source system. After that someone could change the sequence in the CS -- if the mapping of fields in transfer rules remains unchanged, then the load is to be succesful.
    In case of changing the sequence in TS you'll get either error or wrong load (values to be loaded into some infobjects will go to another ones.)
    Best regards,
    Eugene

  • Obtaining Date String From The OS

    Just wondering If anyone can tell me how to obtain a date string or better still a Date object from the operating system. I need to obtain details of the actual date that the application is being started on, which I think should be available from the OS. My only other option is to have the user input the Date on startup which I would like to avoid.
    Many Thanks,
    Stu.

    Date now = new Date();

  • How to store the data captured from oscillosco​pe into the MS Access database table

    Hi All,
    In my application, I tried to save the data captured from SCOPE, but could store only 200 bytes. I've taken the Memo data type for the field in database. I want to store all data ( 4 channels) in one field & retrieve back and display on the XY Graph.
    Thanks in advance.
    Regards,
    Shrini

    kramish wrote:
    Im pretty sure that Access does support JDBCNo it does not. It supports ODBC.
    just doing a quick Google came up with some pages:
    http://blog.taragana.com/index.php/archive/access-microsoft-access-database-from-java-using-jdbc-odbc-bridge-sample-code/
    http://www.javaworld.com/javaworld/javaqa/2000-09/03-qa-0922-access.html
    Both articles explains how to use the jdbc-odbc bridge. I think I've seen a pure jdbc driver for access but it wasn't from Microsoft and it wasn't free.
    Kaj

  • HT1296 I just bought a new MacBook Pro and moved data over from my old MacBook Pro.   Everything seemed fine at first but Outlook 2011 for Mac will not run.  It just flashes the Outlook logo briefly and then closes.  Help!

    Everything seemed to work fine after moving everything over from my old MacBook Pro at first but I cannot run Outlook 2011 for Mac.  The logo displays briefly and then the app closes.  It never really even gets anything loaded other than the little logo.

    Try removing and reinstalling Outlook
    Next try posting in a more appropriate forum. this is the iPod touch forum

  • Concatenate strings from more rows into one row.

    Hi,
    what's the name of that analytical function (or connect by) that
    would return strings from more rows as one row concatenated. i.e.:
    (I know this is possible using regular pipelined functions.)
    ROW1:   STR1
    ROW2:   STR2
    ROW3:   STR3
    select tadah().... from ...
    result:
    ROW1: STR1 STR2 STR3Thanks.

    Hi,
    Here's a basic example of SYS_CONNECT_BY_PATH.
    The query below produces one row of output per department, containing a list of the employees in that department, in alphabetioc order.
    WITH     got_rnum     AS
         SELECT     ename
         ,     deptno
         ,     ROW_NUMBER () OVER ( PARTITION BY  deptno
                                         ORDER BY          ename
                              ) AS rnum
         FROM     scott.emp
    --     WHERE     ...          -- Any filtering goes here
    SELECT     deptno
    ,     LTRIM ( SYS_CONNECT_BY_PATH ( ename
                                  , ','     -- Delimiter, must never occur in ename
               )          AS ename_list
    FROM     got_rnum
    WHERE     CONNECT_BY_ISLEAF     = 1
    START WITH     rnum          = 1
    CONNECT BY     rnum          = PRIOR rnum + 1
         AND     deptno          = PRIOR deptno
    ;Output:
    .   DEPTNO ENAME_LIST
            10 CLARK,KING,MILLER
            20 ADAMS,FORD,JONES,SCOTT,SMITH
            30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARDThe basic CONNECT BY query would produce one row per employee, for example:
    .   DEPTNO ENAME_LIST
            10 ,CLARK
            10 ,CLARK,KING
            10 ,CLARK,KING,MILLER
            20 ,ADAMS
            20 ,ADAMS,FORD
    ...The WHERE clause: <tt>WHERE CONNECT_BY_ISLEAF = 1</tt> means that we'll only see the last row for every department.
    SYS_CONNECT_BY_PATH (which is a row function, by the way, not an analytic fucntion) puts a delimiter (',' in the example above) before every item on the list, including the first one.
    The query above uses LTRIM to remove the delimiter at the very beginning.
    WM_COMCAT (or the equivalent user-defined STRAGG, which you can copy from AskTom) is much more convenient if order is not important.

  • Grabbing Pixels from an image into an array

    Hi,
    I am new to the image processing using java. I want to get the pixel values of an image and store it into an text file. Can anyone help me with this?
    This is what i've done yet? Is the values present in the text field the correct values of the pixels of the image.
    import java.awt.*;
    import java.awt.image.*;
    import java.applet.*;
    import java.util.*;
    public class grabber extends Applet {
    private TextField tf;
    private TextArea ta;
    private Label status;
    private Canvas drawarea;
    private Image img=null;
    int ppmline=0;
    public void init() {
         setLayout(new GridLayout(1,2));
         Panel left=new Panel();
    left.setLayout(new BorderLayout());
    Panel topleft = new Panel();
    topleft.setLayout(new GridLayout(1, 4));
    topleft.add(tf=new TextField());
         Panel buttonsP = new Panel();
    buttonsP.add(new Button("Load GIF"));
         buttonsP.add(new Button("PPM Output"));
         topleft.add(buttonsP);
    left.add("North", topleft);
    left.add("Center", drawarea=new Canvas());
         left.add("South", status=new Label());
         add(left);               // left side of the applet.
         add(ta=new TextArea());          // right side.
         status.setText("See GIF files below.");
    public void paint(Graphics appletg) {
         Graphics g=drawarea.getGraphics();
         if (img != null) {
              g.drawImage(img, 0, 0, this);
              g.dispose();
    public boolean action(Event evt, Object arg) {
         String s=(String) arg;
         if(s.equals("Load GIF")) {
              img=getImage(getCodeBase(), tf.getText());
              repaint();
         else if (s.equals("PPM Output")) getPixs();
    return true;
    void getPixs() {
         int w=30, h=30;
         // PPM output starts.
         ta.setText("P3\n");
         ta.appendText(Integer.toString(w) + " " + Integer.toString(h) + "\n");
         ta.appendText("255\n");
         handlepixels(img, 0, 0, w, h);
    public void handlesinglepixel(int x, int y, int pixel) {
         // pixel is in RGB model. It is a 4-byte long integer.
         // It is converted into the string representation of PPM pixels.
         // ie. Hex 0x00102030 becomes "16 32 48"
         String s= Integer.toString((pixel & 0x00FF0000) >> 16) + " "
              + Integer.toString((pixel & 0x0000FF00) >> 8) + " "
              + Integer.toString(pixel & 0x000000FF) + " ";
    // If we use PPM RAW format, then we have to use ascii characters instead.
    //     char c[]= {(char) ((pixel & 0x00FF0000) >> 16),
    //          (char) ((pixel & 0x0000FF00) >> 8) ,
    //          (char) (pixel & 0x000000FF) };
    //     String s=new String(c);
         if (ppmline++>=3) {                // comment out if you use RAW format.
              ta.appendText(s + "\n");      // comment out if you use RAW format.
              ppmline=0;               // comment out if you use RAW format.
         } else                          // comment out if you use RAW format.
              ta.appendText(s);
    public void handlepixels(Image img, int x, int y, int w, int h) {
    int[] pixels = new int[w * h];
    PixelGrabber pg = new PixelGrabber(img, x, y, w, h, pixels, 0, w);
    try {
    pg.grabPixels();
    } catch (InterruptedException e) {
    System.err.println("interrupted waiting for pixels!");
    return;
    if ((pg.status() & ImageObserver.ABORT) != 0) {
    System.err.println("image fetch aborted or errored");
    return;
    for (int j = 0; j < h; j++) {
    for (int i = 0; i < w; i++) {
    handlesinglepixel(x+i, y+j, pixels[j * w + i]);

    im not at home or id post some source code but first off
    if your going to write a file from a applet your going to
    have to get by permisions.
    so you should probably do this with a application
    it would be alot easier
    use toolkit.getdefaulttoolkit() to get the image then
    use the pixel graber class to read it into a array
    of the type you want string or char
    then just write it into a file each element of the array
    and when you want to read it just read it in with file reader
    you could probaly do a test run just write in each value as
    a string and put a comma between each value then use
    stringtokenizer to read it back in its less efficient but
    for a test run it would make things clearer
    sorry if its not much help

  • How to get input from keyboard scanner into an array

    This is probably a very basic question but I'm very new to java..
    My task is to reverse a string of five digits which have been entered using keyboard scanner.
    E.g. - Entered number - 45896
    Output - 69854
    I used the StringBuffer(inputString).reverse() command for this, but i need a more basic method to do this.
    I thought of defining an array of 5
    int[] array = new int [5];
    and then using,
    Scanner scan = new Scanner(System.in);
    to enter the numbers. But I can't figure out how to get the five input numbers into the array.
    If I can do this I can print the array in reverse order to get my result.
    Any other simple method is also welcome.

    Hey thanks for the quick reply,
    But how can I assign the whole five digit number into the array at once without asking to enter numbers separately?
    E.g. - if entered number is 65789
    Assign digits into positions,
    anArray [0] = 6;
    anArray [1] = 5;
    anArray [2] = 7;
    anArray [3] = 8;
    anArray [4] = 9;
    I'm really sorry but I am very new to the whole subject.

Maybe you are looking for

  • Help needed on Outbound Goods Receipt (IDoc)...

    Hi Experts,   Can we use the message type WMMBXY and IDoc type WMMBID02 for Outbound Goods Receipts scenario also (Sending Goods Receipts information to target system).   Because WMMBID02 seems to be for Inbound going by the documentation in WE60. Ca

  • Regarding internal table

    Hi ,      i have an internal table DATA: BEGIN OF tbl_infile OCCURS 0,          Aufnr(12) type c,          budat(8) TYPE c,          tubes(13) type c,          srap(13) type c,          batches(13) type c,          runmin(13) type c,          stopmin

  • Imported files not showing up in folders

    I've imported .psd files into a folder of .dng images so I can stack them with their originals. They were all saved with Max Compatibility and LightRoom seems to import them ok, but they don't show up in the grid or filmstrip. Their folder listing ha

  • HT201510 Airport Time Capsule

    I need help to set up the Airport time capsule?

  • Inventory listing report to view item balance with the model number in R3

    Hi, Anyone have any ideas does R3 provide standard report to view the report with inventory listing on balance,description,model number? Kindly provide the t-code.