Read data from text file and displaying on Webdynpro

Hi all,
I need some help. I have a text file with set of  name, phonenumbers . I want to know how to display the data using Webdynpro. Could some one help me. help is appreciated and I promise to award points for right answer.
Thank you
Maruti

Hi Maruti,
just open the file and loop on the rows, here an example::
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
FileReader f =  new FileReader("c:
FileName.ext");
while ((s = in.readLine()) != null)
//Here you can put the line into a WD context structure, i.e:
wdContext.currentContoEconomicoFormElement().setField(s);
}catch (Exception e) {.....}
in.close();
f.close();
For any others questions, please, let me know.
Vito

Similar Messages

  • Read data from Excel file and diaplay in Webdynpro

    Hi all,
    I need some help. I have a Excel file with set of  name, phonenumbers . I want to know how to display the data using Webdynpro. Could some one help me. help is appreciated and I promise to award points for right answer.
    Thank you
    Maruti

    <b>Hi
    i can explain you to read data from Excel file
    First You have to download the jxl.jar file. You can get this file from the Below site
    </b><a href="http://www.andykhan.com/jexcelapi/download.html">jexcelapi jar</a>
    It will be in Compressed Fromat So Unzip it to get the Contents
    After Unzipping The File You will get a Folder (jexcelapi/jxl.jar)
    Now in NWDS open web dynpro explorer, Right Click Your Project, a popup menu will appear and in that click Properties
    You will get window displaying your Project Properties
    On Left Side of the window You Will Find "Java Build Path"
    Click That "Java Build Path" and you will get 4 Tabs Showing ( Source,Projects,Libraries,Order and Export)
    Click Libraries Tab
    You will find options many options buttons
    In that click the Button "Add External Jars"
    You will get Window in order to fecth the jxl.jar file from the location you had stored
    After selecting the jxl.jar i will get displayed and click ok
    Now Open Navigator
    Open Your Project
    You will find Lib folder
    Copy the jxl.jar to that lib folder
    Note : You cannot Read the Content from the excel file directly
    First You Have to copy that file to the Server,
    And from the Server you can get the file absolute path
    With the absolute path you can read the contents of the Excel file
    You have to save the Excel file as .xls Format and Not as xlsx format i will not accept that...
    You have Upload the Excel file from the Server Using the File Upload UI Element
    This Coding will extract 3 columns from the Xls File
    Coding
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import jxl.Cell;
    import jxl.Sheet;
    import jxl.Workbook;
    import com.sap.fileupload.wdp.IPrivateFileUpload_View;
    import com.sap.tc.webdynpro.services.sal.datatransport.api.IWDResource;
    public void onActionUpload_File(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUpload_File(ServerEvent)
        IPrivateFileUpload_View.IContextElement element1 = wdContext.currentContextElement();
        IWDResource resource = element1.getFileResource();
        element1.setFileName(resource.getResourceName());
        element1.setFileExtension(resource.getResourceType().getFileExtension());
        //@@end
    public void onActionUpload_File_in_Server(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUpload_File_in_Server(ServerEvent)
        InputStream text=null;
        int temp=0;
        try
             File file = new File(wdContext.currentContextElement().getFileResource().getResourceName().toString());
             FileOutputStream op = new FileOutputStream(file);
             if(wdContext.currentContextElement().getFileResource()!=null)
                  text=wdContext.currentContextElement().getFileResource().read(false);
                  while((temp=text.read())!=-1)
                       op.write(temp);                                      
             op.flush();
             op.close();
             path = file.getAbsolutePath();
             wdComponentAPI.getMessageManager().reportSuccess(path);
        catch(Exception e)
             e.printStackTrace();
        //@@end
    public void onActionUpload_Data_into_Table(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUpload_Data_into_Table(ServerEvent)
        try
              Workbook wb =Workbook.getWorkbook(new File(path));
              Sheet sh = wb.getSheet(0);
              //wdComponentAPI.getMessageManager().reportSuccess("Columns = "+sh.getColumns());
              //wdComponentAPI.getMessageManager().reportSuccess("Rows = "+sh.getRows());
              int columns = sh.getColumns();
              int rows = sh.getRows();
              int i=0;
             for(int j=1;j<=rows;j++)
                       ele=wdContext.nodeTable_Data().createTable_DataElement();
                       Cell c1 = sh.getCell(i,j);
                      ele.setTab_Name(c1.getContents());
                       Cell c2 = sh.getCell(i+1,j);
                       ele.setTab_Degree(c2.getContents());
                          Cell c3 = sh.getCell(i+2,j);
                       ele.setTab_Percentage(c3.getContents());
                       wdContext.nodeTable_Data().addElement(ele);
        catch(Exception ex)
             wdComponentAPI.getMessageManager().reportSuccess(ex.toString());
        //@@end
       * The following code section can be used for any Java code that is
       * not to be visible to other controllers/views or that contains constructs
       * currently not supported directly by Web Dynpro (such as inner classes or
       * member variables etc.). </p>
       * Note: The content of this section is in no way managed/controlled
       * by the Web Dynpro Designtime or the Web Dynpro Runtime.
      //@@begin others
      String path;
      IPrivateFileUpload_View.ITable_DataElement ele;
    //@@end
    Regards
    Chandran S

  • Reading data From XML file and setting into ViewObject to Pouplate ADF UI

    Hi,
    I have following requirement.
    I would like to read data from XML file and populate the data in ViewObject so that the data can be displayed in the ADF UI.
    Also when user modifies the data in the ADF UI, it should be modified back into to ViewObject.
    Here is an example - XML file contains Book Title and Author. I would like to read Book Title and Author from XML file and set it into ViewObject Attribute and then display Book title and Author in ADF UI page. Also when user modifies Book title and Author, I would like to store it back in View Object.
    Please help me with this requirement and let me know if any solution exist in ADF, for populating the ADF UI screen fields with external XML file data.
    Thanks

    Read chapter 42 http://download.oracle.com/docs/cd/E16162_01/web.1112/e16182/bcadvvo.htm of the fusion developer guide
    Section 42.7, "Reading and Writing XML"
    Section 42.8, "Using Programmatic View Objects for Alternative Data Sources"
    Timo

  • Reading Data from Unix file and write into an Internal table

    Dear all,
                     I am having an requirement of reading data from unix file and write the same into an internal table..how to do that ...experts please help me in this regard.

    Hi,
    do like this
    PARAMETERS: p_unix LIKE rlgrap-filename OBLIGATORY.
    DATA: v_buffer(2047) TYPE c.
    DATA: BEGIN OF i_buffer OCCURS 0,
            line(2047) TYPE c,
    END OF i_buffer.
    * Open the unix file..
    OPEN DATASET p_unix FOR INPUT IN TEXT MODE.
    <b>IF sy-subrc NE 0.
    *** Error Message "Unable to open file.
    ELSE.</b>
       DO.
         CLEAR: v_buffer.
         READ DATASET p_unix INTO v_buffer.
         IF sy-subrc NE 0.
            EXIT.
         ENDIF.
         MOVE v_buffer TO i_buffer.
         APPEND i_buffer.
      ENDDO.
    ENDIF.
    CLOSE DATASET p_unix.
    <b>Reward points if it helps,</b>
    Satish

  • Help! Read raw Image data from a file and display on the JPanel or JFrame.

    PLEASE HELP, I want to Read Binary(Raw Image)data (16 bit integer) from a file and display on the JPanel or JFrame.

    Hey,
    I need to do the same thing. Did you find a way to do that?
    Could you sent me the code?
    It's urgent, please.
    My e-mail is [email protected]

  • Read data from xml files and  populate internal table

    Hi.
    How to read data from xml files into internal tables?
    Can u tell me the classes and methods to read xml data..
    Can u  explain it with a sample program...

    <pre>DATA itab_accontextdir TYPE TABLE OF ACCONTEXTDIR.
    DATA struct_accontextdir LIKE LINE OF itab_accontextdir.
    DATA l_o_error TYPE REF TO cx_root.
    DATA: filename type string ,
                 xmldata type xstring .
    DATA: mr      TYPE REF TO if_mr_api.
    mr = cl_mime_repository_api=>get_api( ).
    mr->get( EXPORTING  i_url     = 'SAP/PUBLIC/BC/xml_files_accontext/xml_accontextdir.xml'
                  IMPORTING  e_content = xmldata ).
    WRITE xmldata.
    TRY.
    CALL TRANSFORMATION id
          SOURCE XML xmldata
          RESULT shiva = itab_accontextdir.
      CATCH cx_root INTO l_o_error.
    ENDTRY.
    LOOP AT itab_accontextdir INTO struct_accontextdir.
        WRITE: / struct_accontextdir-context_id,
               struct_accontextdir-context_name,
               struct_accontextdir-context_type.
        NEW-LINE.
        ENDLOOP.</pre>
    <br/>
    Description:   
    In the above code snippet I am storing the data in an xml file(you know xml is used to store and transport data ) called 'xml_accontextdir.xml' that is uploaded into the MIME repository at path 'SAP/PUBLIC/BC/xml_files_accontext/xml_accontextdir.xml'.
    The below API is used to read a file in MIME repo and convert it into a string that is stored in ' xmldata'. (This is just a raw data that is got by appending the each line of  xml file).
    mr = cl_mime_repository_api=>get_api( ).
    mr->get( EXPORTING  i_url     = 'SAP/PUBLIC/BC/xml_files_accontext/xml_accontextdir.xml'
                  IMPORTING  e_content = xmldata ).
        Once the 'xmldata' string is available we use the tranformation to parse the xml string that we have got from the above API and convert it into the internal table.
    <pre>TRY.
    CALL TRANSFORMATION id
          SOURCE XML xmldata
          RESULT shiva = itab_accontextdir.
      CATCH cx_root INTO l_o_error.
    ENDTRY.</pre>
    Here the trasnsformation 'id ' is used to conververt the source xml 'xmldata' to resulting internal table itab_accontextdir, that have same structure as our xml file 'xml_accontextdir.xml'.  In the RESULT root of the xml file has to be specified. (In my the root is 'shiva'). 
    Things to be taken care:
    One of the major problem that occurs when reading the xml file is 'format not compatible with the internal table' that you are reading into internal table.  Iin order to get rid of this issue use one more tranformation to convert the data from the internal table into the xml file.    
    <pre>TRY.
          CALL TRANSFORMATION id
            SOURCE shiv = t_internal_tab
            RESULT XML xml.
        CATCH cx_root INTO l_o_error.
      ENDTRY.
      WRITE xml.
      NEW-LINE.</pre>
    <br/>
    This is the same transformation that we used above but the differnce is that the SOURCE and RESULT parameters are changed the source is now the internal table and result is *xml *string. Use xml browser that is available with the ABAP workbench to read the xml string displayed with proper indentation. In this way we get the format of xml file to be used that is compatable with the given internal table. 
    Thank you, Hope this will help you!!!
    Edited by: Shiva Prasad L on Jun 15, 2009 7:30 AM
    Edited by: Shiva Prasad L on Jun 15, 2009 11:56 AM
    Edited by: Shiva Prasad L on Jun 15, 2009 12:06 PM

  • We want to read data from weigh bridge and display in oracle forms & store

    Sir/Madam,
    in our organisation we had one requirement. i.e is reading data from weigh bridge using serial port, displying that data in oracle forms and when ever user click save button we store that into my oracle database. we are using oracle 8i and forms 6i and windows OS environment. we don't know reading data from serial port and placing that into form items. please help me as early as possible if there is any property available in d2k regarding this requirement .
    thank you,
    vishnu

    There's no property in Forms that makes you read serial ports, but as far as I know you need to know the API of the machine which you want to read data from (it should come with machine's manual) and then it will be easy to store it in forms item.
    Tony

  • Pool data from text file and insert into database

    Can anyone tell me how to pool data from a text file and insert into database?
    let's say my text file is in this format
    123456 Peter 22
    234567 Nicholas 24
    345678 Jane 20
    Then I need to insert the all the value for this three column into a table which has the three column name ID, Name, Age
    Anyone knows? I need to do this urgently...Thank in advanced

    1. Use BufferedReader and read the file line by line.
    2. Loop thru the file and do the following steps with in this loop.
    3. Use StringTokenizer to seperate each line into three values (columns).
    4. Now create a insert statement with these values and add the statement to the batch (using addBatch() method of PreparedStatement or Statement).
    5. Finally (after exiting the loop), execute these batch of statements (using ps.executeBatch()).
    Sudha

  • Screen data entry box that displays data from text file AND write back to file.

    I want the user to be able to view/edit a 'setup file' FROM THE SAME INDICATOR BOXES for a application. I tried to read the file(text), display individual data in indicator boxes and re-write file when user is finished. This causes errors since you can't use indicators boxes as inputs for the file write. Is there some kind of indicator/control/data entry box that the user can view the data, edit the data, and re-write the data from the box???

    hi
    I have created this example for your reference.
    I modified the Configuration File Examples in LV Examples, together with a few file check & create functions.
    Hope this will help.
    Note: The Configuration File Example from LV are COOL, indeed.
    Cheers
    ian.f
    Ian F
    Since LabVIEW 5.1... 7.1.1... 2009, 2010
    依恩与LabVIEW
    LVVILIB.blogspot.com
    Attachments:
    iFunc_Setup_Config_File.zip ‏102 KB

  • How to open and read data from text file in PL/SQL

    We have a project ,need to open a file containing entries of data
    ,then process those data records one by one to update the
    database.This operation shoulbe be done in the database
    enviroment. Is there any hint about the file operation in
    PL/SQL? How to open the file and get one record ,maybe one line,
    and parse and get the data field ?
    thanks
    defang

    There was also a question on this over at AskTom
    (asktom.oracle.com) about a week ago complete with sample code.
    The pointer to the sample code is here:
    <A HREF="http://asktom.oracle.com/pls/ask/f?
    p=4950:8:::::F4950_P8_DISPLAYID:464420312302
    TARGET=_blank>http://asktom.oracle.com/pls/ask/f?
    p=4950:8:::::F4950_P8_DISPLAYID:464420312302</A>
    Admittedly it's about Win95, but the principles should apply.
    Yours faithfully, Graham Reeds.
    [email protected] | http://omnieng.co.uk/

  • Read data from text file one by one using for loop

    Dear Forum
    I want to read data of single colum of text file inside the for loop one by one(for each iteration value must be replaced by another value of text file).This value is used by a formula inside for loop. also after completion of iterations the values must be plotted on xy graph. How to do it.? please help me.
    profravi

    It's not very efficient to read a file line by line. Much simpler to read it all at once and then auto-index the results inside a for loop. The image below shows a generic solution to your problem. This assumes that the data in the file is in a single column.
    I would also recomend checking ou the learning LabVIEW resources here.
    I would aslos suggest that since this type of question is not specific to either NI-Elvis or the LabVIEW SE, you should post similar questions to the LabVIEW board. If you have problems, attaching a sample of the text file would help.
    Message Edited by Dennis Knutson on 10-18-2007 09:11 AM
    Attachments:
    XY Graph From File.PNG ‏4 KB

  • How to read data from multiple files and append in columns in one file

    Hi Guys,
    I have a problem in appending data from files in different columns. I have attachement has file A and B which I am reading and not able to get data as in file Result.txt. Please comment on how can I do this
    Solved!
    Go to Solution.
    Attachments:
    Write to file.vi ‏13 KB
    A.txt.txt ‏1 KB
    B.txt.txt ‏1 KB

    You cannot append columns to an existing file. Since the data is arrange line-by-line as one long linear string in the file, you can only append rows. A new row needs to be interlaced into the original file, shifting everything else. If you want to append rows, you need to build the entire output structure in memory and then write all at once.
    (I also don't think you need to set the file positions, it will be remembered from the last write operation.)
    Unless the files are gigantic, here's what I would do:
    (Also note that some of your rows have an extra tab at the end. If this is normal, you need a little bit more code to strop out empty columns. I include cleaned up files in the attachment. I also would not call them A.txt.txt etc. A plain A.txt is probably sufficient.)
    EDIT: It seems Dennis's solution is similar )
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Write to fileMOD.zip ‏6 KB
    MergeColumns.png ‏6 KB

  • HOW TO READ DATA FROM A FILE AND INSERT INTO A TABLE USING UTL_FILE

    Hi..
    I have a file.I want to read the data from file and load it into a table using utl_file.
    how can I do it?
    Any reply apreciated...

    Hi,
    This is not your requirment but u can try this :
    CREATE OR REPLACE DIRECTORY text_file AS 'D:\TEXT_FILE\';
    GRANT READ ON DIRECTORY text_file TO fah;
    GRANT WRITE ON DIRECTORY text_file TO fah;
    DROP TABLE load_a;
    CREATE TABLE load_a
    (a1 varchar2(20),
    a2 varchar2(200))
    ORGANIZATION EXTERNAL
    (TYPE ORACLE_LOADER
    DEFAULT DIRECTORY text_file
    ACCESS PARAMETERS
    (FIELDS TERMINATED BY ','
    LOCATION ('data.txt')
    select * from load_a;
    CREATE TABLE A AS select * from load_a;
    SELECT * FROM A
    Regards
    Faheem Latif

  • Student in distress: Read data from text file to fill a JTable

    I'm already late 2 weeks for my project and I still can't figure this out :(
    The project is made of 3 classes; the main one is Viewer.java; it creates the interface, Menu.java that manages the menu and the methods related to it and finally JTableData.java that extends JTable ( This is the part that I don't really understand)
    In the class MENU.JAVA I wrote the method jMenuOpen_actionPerformed(...) for the button OUVRIR (Open) that let's me select the file to read, then puts the content in a 2D table. Here' s my problem: I have to somehow update the content of the table created in VIEWER.JAVA with the content read from the file (cvs file delimited by ";") using a JTableData object (?)
    //THIS IS THE FIRST CLASS VIEWER.JAVA THAT CONTAINS THE MAIN METHOD
    //AND CREATES THE INTERFACE
    package viewer;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Viewer extends JFrame {
      public Menu menu = null;
      GridLayout gridLayout1 = new GridLayout();
      JTabbedPane jTabbedPane = new JTabbedPane();             
      JTableData jTableInfo = new JTableData(30, 7);
      public Viewer() {
              addWindowListener(new WindowAdapter()
              {               public void windowClosing(WindowEvent e)
                        dispose();
                        System.exit(0);
            try 
                jbInit();
                this.setSize(1000, 700);
                this.setVisible(true);
            catch(Exception e)
                e.printStackTrace();
      public static void main(String[] args) {
          Viewer viewer = new Viewer();
      private void jbInit() throws Exception {
        menu = new Menu(this);
        gridLayout1.setColumns(1);
        this.setTitle("Viewer");
        this.getContentPane().setLayout(gridLayout1);
        jTableInfo.setMaximumSize(new Dimension(0, 64));
        jTableInfo.setPreferredSize(new Dimension(0, 64));
        //TO DO Partie de droite
        JTabbedPane webViewerTabs = new JTabbedPane();
        //972 3299
        //java.net.URL URL1 = new java.net.URL("http://www.nba.com");
        //java.net.URL URL2 = new java.net.URL("http://www.insidehoops.com");
        //java.net.URL URL3 = new java.net.URL("http://www.cnn.com");
        JEditorPane webViewer01 = new JEditorPane();
        webViewer01.setEditable(false);
        //webViewer01.setPage(URL1);
        JEditorPane webViewer02 = new JEditorPane();
        webViewer02.setEditable(false);
        //webViewer02.setPage(URL2);
        JEditorPane webViewer03 = new JEditorPane();
        webViewer03.setEditable(false);
        //webViewer03.setPage(URL3);
        webViewerTabs.addTab("Site01", webViewer01);
        webViewerTabs.addTab("Site02", webViewer02);
        webViewerTabs.addTab("Site03", webViewer03);
        jTabbedPane.add(webViewerTabs);
            //End TO DO   
        this.getContentPane().add(jTableInfo);
        this.getContentPane().add(jTabbedPane);
        this.setJMenuBar(menu);  
    //This is the MENU.JAVA CLASS WHERE I OPEN THE FILE, READ THE
    //CONTENT AND WHERE I SHOULD SEND THE DATA TO THE TABLE.
    //Title:        Menu
    //Author:       Luc Duong
    package viewer;
    import javax.swing.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    public class Menu extends JMenuBar {
      JMenu jMenu1 = new JMenu();
      JMenuItem jMenuNew = new JMenuItem();
      JMenuItem jMenuOpen = new JMenuItem();
      JMenuItem jMenuSave = new JMenuItem();
      JMenuItem jMenuExit = new JMenuItem();
      JMenuItem jMenuApropos = new JMenuItem();
      JFileChooser fileChooser = new JFileChooser();
      Viewer viewer = null;
      boolean isFileChanged = false;
      private File fileName;
      static String data [][] = new String[7][9];
      public int lineCount;
      public Menu(Viewer viewer) {
        try  {
          jbInit();
          this.viewer = viewer;
          this.add(jMenu1);
        catch(Exception e) {
          e.printStackTrace();
      private void jbInit() throws Exception {
        jMenu1.setText("Fichier");
        jMenuNew.setText("Nouveau");
        jMenuNew.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jMenuNew_actionPerformed(e);
        jMenuOpen.setText("Ouvrir");
        jMenuOpen.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jMenuOpen_actionPerformed(e);
        jMenuSave.setText("Sauvegarder");
        jMenuSave.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jMenuSave_actionPerformed(e);
        jMenuExit.setText("Quitter");
        jMenuExit.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jMenuExit_actionPerformed(e);
        jMenuApropos.setText("A propos");
        jMenuApropos.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jMenuApropos_actionPerformed(e);
        jMenu1.add(jMenuNew);
        jMenu1.add(jMenuOpen);
        jMenu1.add(jMenuSave);
        jMenu1.add(jMenuExit);       
        jMenu1.add(jMenuApropos);   
      void jMenuNew_actionPerformed(ActionEvent e) {
      //THIS IS THE METHOD I'M WORKING ON RIGHT NOW
      void jMenuOpen_actionPerformed(ActionEvent e) {
          fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
          int result = fileChooser.showOpenDialog(this);
          if (result == JFileChooser.CANCEL_OPTION) return;
          if (result == JFileChooser.APPROVE_OPTION)
              //[email protected]
              File chosenFile = fileChooser.getSelectedFile();
              String path = chosenFile.getPath();
              String nom = chosenFile.getName();
              boolean exist = chosenFile.exists();
              try
                FileReader fr = new FileReader(chosenFile);
                BufferedReader reader = new BufferedReader(fr);
                System.out.println("Opening File Successful!" + chosenFile.getName());
                //String  qui contient la ligne courante
                String currentLine = new String();
                StringTokenizer currentLineTokens = new StringTokenizer("");
                int row = 0;
                int column = 0;
                while( (currentLine = reader.readLine() ) != null)
                    currentLineTokens = new StringTokenizer(currentLine,";");
                    System.out.println("Now reading line index: " + row);
                    while(currentLineTokens.hasMoreTokens())
                        data[row][column] = currentLineTokens.nextToken();
                        System.out.println(column + "\t" + data[row][column]);
                        if(column>=8) column=-1;
                        column++;
                    row++;
                lineCount = row-1;
                System.out.println("\nNombre total de lignes: " + lineCount);
            catch(Exception ex)
                System.out.println("Test: " + ex.getMessage());
                JOptionPane.showMessageDialog(this, "Erreur d'ouverture du fichier", "Erreur d'ouverture du fichier", JOptionPane.ERROR_MESSAGE);
      void jMenuSave_actionPerformed(ActionEvent e) {
          if (JFileChooser.APPROVE_OPTION == fileChooser.showSaveDialog(this))
                System.err.println("Save: " + fileChooser.getSelectedFile().getPath());     
      void jMenuExit_actionPerformed(ActionEvent e) {
        if (!isFileChanged)
           System.exit(1);
        else
            JOptionPane.showConfirmDialog(null, "Do you want to save now?", "Save?", JOptionPane.YES_NO_OPTION);
          // ask the user if he want to save
          // yes or no?
          // yes
           jMenuSave_actionPerformed(e);
          // no
          System.exit(1);
      void jMenuApropos_actionPerformed(ActionEvent e) {
    //THIS IS THE JTABLEDATA.JAVA CLASS THAT EXTENDS JTable. I'm not sure
    // how this works :(//Title: JTableData
    //Author: Luc Duong
    package viewer;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class JTableData extends JTable {
    public JTableData(int row, int col)
    super(row, col);

    Hi, Salut
    you should use JTable's DataModel to update your table.
    data[row][column] = currentLineTokens.nextToken();
    jTableInfo.getModel().setValueAt(data[row][column], row, column);
    jTableInfo.repaint();BEWARE CSV files and StringTokenizer, i've had problems with it (for example ;;Test; is not tokenized "", "", "Test")
    StringTokenizer ignores separator when in first position, and ignores double separators. I use this piece of code before tokenize a String :
    private static char _separator = ';';
    private static String checkCsvString(String s) {
             * V�rification du s�parateur inital, perdu par le StringTokenizer et
             * pourtant bien important
            if (s.startsWith("" + _separator)) {
                s = " " + s;
             * V�rification des doubles s�parateurs, perdus par le StringTokenizer
            int index;
            while ((index = s.indexOf("" + _separator + _separator)) >= 0) {
                s = s.substring(0, index) + _separator + " " + _separator + s.substring(index + 2);
            return s;
        }hope it helps
    Nico

  • Applescript to read data from text file

    Hello all, I am writing an Applescript to read a file and put that file's contents into a variable. However, when I use the applescript command "read", I get the error:
    The text file reads "4.65". I need to extract that number to show up in a dialog box. This is the code I have so far.
    set milefile to ("Macintosh HD:Users:RyanSiebecker:Documents:Scripts:Source-Files:Running-Files:milefile.tx t")
    set theFileContents to (read file milefile)
    I am stuck and I cannot find any other way to do this.
    As always, any help is appreciated.
    Thanks, Ryan

    Have you noticed that your file name's extension (".tx t") has a space in it?  Though that mismatch would get a -43 Not Found error, not EOF.
    Your code ( with and without the gapped extension) works here. 
    Maybe the path isn't perfect?
    To make a perfect path easily, start with this:
         set milefile to POSIX file ("")  -- note the null string ("")
    Then arrange your windows so that you can drag the icon representing your file from wherever it is in the Finder's world into your AppleScript Editor's window, and carefully drop it right between the ""s.
    If you miss, don't worry.  It'll be selected, so just Cut and then Paste it between the ""s.  You'll get a perfect path, only with slashes instead of colons.  The "POSIX file" specifier converts it to "colon notation", still perfectly.
    --Gil

Maybe you are looking for