Writing random array positions to file

Hi all.
I have an array of 1000 positions each consisting of a String.
I want to write the strings equally to two seperate text files which i have managed without any probs.
The problem is i want to write these strings in a total random order so each time its run different strings would end up in different files and in total different order.
i know how to generate a random number but not sure how to access all positions of the array but in random order.
Any help would be appreciated.
thanks

The Random class has methods that generate random ints.
You can use those ints to index the array and get the String from that position.
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Random.html

Similar Messages

  • Help!! Trying to writing an array to a file without having to rewrite the old data every time.

    Hey Everyone,
    I have a vi that takes a 2D array and writes it to an xml file. The purpose for this is to characterize the pathloss through a dowkey 10x10 matrix at varies frequencies. I use this program to create a look-up table for the switch matrix so when I conduct one of my automated tests I can obtain an accurate measurment. The problem with this is I am taking about 299 data points per switch matrix combination leading me to over 32000 data points in the look-up table. The reason I use xml is because each data point needs a header so I can parse through the look-up table with another one of my vi's when I need that pathloss. What I am trying to fix is that when my vi writes to a file it writes one array at a time to save memory space. When it writes it rewrites the old data then the new data. As the number of data points increase so does the lag time to write to the file. By the time I am done it takes about five hours to fully write to the file. Does anyone know of a way to write continuesly write to a file without having to rewrite all of the old data? Attached is my vi for writing to the file, my vi for searching through the file, and an example of one of my look-up tables.
    Thanks,
    Dustin
    Solved!
    Go to Solution.
    Attachments:
    Find Array_TestStand.vi ‏22 KB
    Write to XML.vi ‏21 KB
    Pathloss_Array_tests.zip ‏149 KB

    dlovell wroteoes anyone know of a way to write continuesly write to a file without having to rewrite all of the old data?
    The only way to do that is to only append to the end of your file.  This would probably require some rewriting of your header information.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Writing int [ ] Array in a file

    Hye
    Can you tell me which Stream I can use to write an Integer Array (defined as int [ 7000]) in a file .txt
    I want to write as a whole not one by one.
    Thanks

    import java.util.Vector;
    import java.io.*;
    public class Queue extends Vector {
      ** FIFO, first in first out
      Queue() {
      super();
    void put(Object o) {
      addElement(o);
    Object get() {
      if (isEmpty()) return null;
        Object o = firstElement();
        removeElement(o);
        return o;
    Object peek() {
      if (isEmpty()) return null;
        return firstElement();
    To serialize (save the Queue state to a file) :
    public static void main(String args[]) {
      Queue theQueue;
      theQueue = new Queue();
      theQueue.put(new int[]{1, 2, 3, 4});
      theQueue.put("ABCDE");
      theQueue.put(new Integer(3));
      System.out.println(theQueue.toString());
      // serialize the Queue
      System.out.println("serializing theQueue");
      try {
          FileOutputStream fout = new FileOutputStream("thequeue.dat");
          ObjectOutputStream oos = new ObjectOutputStream(fout);
          oos.writeObject(theQueue);
          oos.close();
       catch (Exception e) { e.printStackTrace(); }
    To unserialize (to load a previously saved Queue) :
    public static void main(String args[]) {
       Queue theQueue;
       theQueue = new Queue();
       // unserialize the Queue
       System.out.println("unserializing theQueue");
       try {
        FileInputStream fin = new FileInputStream("thequeue.dat");
        ObjectInputStream ois = new ObjectInputStream(fin);
        theQueue = (Queue) ois.readObject();
        ois.close();
       catch (Exception e) { e.printStackTrace(); }
       System.out.println(theQueue.toString());    
    }hope that helps

  • Writing an integer array to a file...

    Okay, so I just wanna write a sorted integer array to file... but I'm having a problem or two.
    int[] array = read(new File("C:\\college work\radixsort.txt");
    radixSort(array, array.length);That text file is a list of 30 numbers.
    After the radixSort method is called the values in the text file are sorted into the correct order. Then I want to write the sorted values to a text file radixSorted.txt
    I had too many problems with printArray() so I figured this could be easier.
    I have tried FileInputStream and FileWriter but no luck.
    I don't want the answer, but just something to help point me in the right direction.
    Thank you.

    pri.println(char[] x) looks like the one I am looking for.
    I have modified the code. I've placed only the println part inside the loop now, but it's just the pri.println(char[], array) now. I'm nearrrrly there! (I think).
    try
                   PrintWriter pri = new PrintWriter(new FileWriter("C:/college work/radixsort.txt", true));
                   for (int h = 0; h < array.length; h++)
                        pri.println(char[], array);
              catch (Exception e)
                   e.printStackTrace();
                   System.out.println("No such file exists.");
              finally
                   pri.close();
              }Edited by: JayJay88 on Nov 8, 2008 1:16 PM

  • Time Stamp problem while writing data into the excel file

    Hii, All
                  I am taking the data from the DAQ card of the TOPSCCC with the 8 ms of scanrate for each channel and there are total 16 no of Analog channels in the Card, now i am acquiring the data from the card, time stamping it and writing it into the excel file, which is tab delimited, now the problem is, the data which are in the excel file have the same timestamp for 4 to 5 continuous records, instead we want each data with the different and continuous time stamp with same difference of time stamp between two records, mean if it is difference of 8 ms then it should be the 8 ms for all, but here it is taking the differnce of 16 ms for two samples and giving same time stamp for four to five records and that shouldn't happen, here i am attaching my vi, drivers for the cards and Excel file with the data, can you please give me any suggestion how to do it?
           Please help me i require this suggestion as early as possible, i am requiring it urgently.
    Thanks in Advance,
    Nishant
    Attachments:
    2026vi.llb ‏319 KB
    2026_ScanMultAD_Demo_time.vi ‏80 KB
    Data.xls ‏357 KB

    Hello Nishant,
    that's what I meant:
    Message Edited by GerdW on 05-16-2006 10:32 AM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    timestamp-array.png ‏2 KB

  • Problem: check random array with a static value

    My goal is to use the random number generator to put numbers into randomArray, then do a linear search to try to find if the number 5 has been generatated. Next print out where in the array the value can be found. I have no compile errors but I have a logical or syntax problem, any help would be great.
    public class test {
         int j;
         int target = 5;
         public static void main(String [] args) {
              int i;
              int[] randomArray = new int[20];
              for(i=0; i<randomArray.length; i++) {
                   randomArray[i] = (int)(Math.floor(Math.random() * (10.0 - 0.0)) + 0.0);
              test n = new test();
              n.display();
         public int arraySearch(int[] randomArray, int target) {
              for (j=0; j<randomArray.length; j++) {
                   if (randomArray[j] == target) {
                        return j;
              return -1;
         public void setArraySearch(int j) {
              j = j;
         int p;
         public void setArrayValues(int[] randomArray) {
              for (int k=0; k<randomArray.length; k++) {
                   p = randomArray[k];
         public void display() {
              System.out.println("Five is found in array position " + j);
              System.out.println(p);
    }

    Hi,
    That's correct. You need to call the other methods just as you call display, but you do also have some other minor problems. You have written some methods that aren't needed, and they do nothing. This might help you:
    public class test {
         public static void main(String [] args) {
              int i;
              int[] randomArray = new int[20];
              for(i=0; i<randomArray.length; i++) {
                   randomArray[i] = (int)(Math.floor(Math.random() * (10.0 - 0.0)) + 0.0);
              test n = new test();
              int indexFound = n.arraySearch(randomArray, 5);                
              n.display(indexFound );
         public int arraySearch(int[] randomArray, int target) {
              for (j=0; j<randomArray.length; j++) {
                   if (randomArray[j] == target) {
                        return j;
              return -1;
         public void display(int indexFound) {
              System.out.println("Five is found in array position " + indexFound);
    } /Kaj

  • I/O Error when writing access Log buffer to file. error number: 28

    Hi,
    Oracle OracleAS Web Cache 10.1.2.3.0, Build 10.1.2.3.0 080201 is writing events like this:
    [alert 13215] I/O Error when writing access Log buffer to file. error number: 28
    I've looked for this alert and i've found this description:
    WXE-13215 I/O Error when writing access Log buffer to file. error number: %d
    Severity: alert
    Cause: I/O error happened when OracleAS Web Cache tried to write to the access log file.
    Action: Check the status of access log file. For example, see if the disk is full
    Anybody knows what "error number: 28" stands for? The logs are sended to other server and it seems that the disk size is ok.
    thanks!

    I tested again...it seems LabVIEW doesn't like the way I wrote the measurement files. I attached a set of VIs (ZIP-file) to give you a clue how it was done. When I try to save and read a file containing just plain DBLs from a 1D-Array (see attached file generating VI) it works perfectly well for large file sizes.
    So there might get something messed up by the way LabVIEW saved the measured data. You'll notice, that I (accidentally) left the "prepend array string size" input of "write to binary file" function unwired which means that the size information will be written as a type of header. Maybe this is the reason that it doesn't work as expected...
    Attachments:
    VibrationMeasurement.zip ‏76 KB
    generate_test_bin_data.vi ‏12 KB

  • Saving An Object Array to a File

    Please Help,
    I am fairly new to Java. I am trying to write a program that inputs merchandise information (ItemName, Description, Price, etc�) to an object array. The program works internally with the array perfectly, but I can�t get it to save the array to a file so it can be read and reused the next time the program is run. The class the array is built on implements Serializable, but when it tries to save it to a file, it throws an exception message saying that my object is not serializable.
    Does anyone have some code to help me save information to an array (so it can be used within the program), save the array to a disk file, and read the file back into the program the next time the program opens?
    Thank you,
    Bob

    Thank you for your help. The total code is quite lengthy so I�ve tried to pick the most relevant code to include here.
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.text.*;
    import java.io.*;
    public class Class1 extends WindowAdapter implements ActionListener
    // Object Array Declaration.
    ItemInfo ItemArray[] = new ItemInfo[100];
    * This is the Inner Class that the Array is built on. I have two constructors in it because I
    * tried several different methods to make this write to the disk file
    public class ItemInfo implements Serializable
         int ItemNum;
         int DeptNum;
         String ItemName;
         String Model;
         String Description;
         float Price;
         int Units;
    // Constructors
         public ItemInfo() {};
         public ItemInfo(int inItemNum, int inDeptNum, String
                             inItemName, String inModel, String
                             inDescription, float inPrice, int inUnits)
              ItemNum = inItemNum;
              DeptNum = inDeptNum;
              ItemName = inItemName;
              Model = inModel;
              Description = inDescription;
              Price = inPrice;
              Units = inUnits;
    } // end class ItemInfo.
    * openOutputStream() *
         private void openOutputStream()
              try
              // create file and output object streams
                   outputItemFile = new FileOutputStream("A:ItemFile.txt");
                   objSaveItems = new ObjectOutputStream(outputItemFile);
              } // end try
              catch (Exception error)
                   System.err.println("Error opening file");
              } // end catch
         } // end openOutputStream().
    * closeOutputStream() *
         private void closeOutputStream()
              try
                   objSaveItems.close();
                   outputItemFile.close();
              catch (IOException error)
                   System.err.println("Error Closing File");
              } // end catch
         } // end closeOutputStream().
    * AddToItemArray() - This method just assigns the information to the Array elements *
         private void AddToItemArray()
              int ArrayNum = intItemFileSize - 1;
              ItemArray[ArrayNum] = new ItemInfo();
              ItemArray[ArrayNum].ItemNum = intNewItemNum;
              ItemArray[ArrayNum].DeptNum = intDeptNum;
              ItemArray[ArrayNum].ItemName = strItemName;
              ItemArray[ArrayNum].Model = strModel;
              ItemArray[ArrayNum].Description = strDescription;
              ItemArray[ArrayNum].Price = fltPrice;
              ItemArray[ArrayNum].Units = intUnits;
         } // end AddToItemArray().
    * WriteToFile() - This is the latest effort to write to the file. The file gets opened, and
    * the first element gets printed, but after that nothing but error messages (printed * below).
         private void WriteToFile()
              try
                   openOutputStream();
                   for (int a = 0; a <= intItemFileSize; a++)
                        objSaveItems.writeObject(ItemArray[a]);
                        objSaveItems.flush();
                   closeOutputStream();
              } // end try.
              catch (Exception error)
                   System.err.println("Error writing to file");
         } // end WriteToFile().
    This is what appears on the disk file after I run the program (three items entered):
    � sr Class1$ItemInfo�&q����B I DeptNumI ItemNumF PriceI UnitsL
    Descriptiont Ljava/lang/String;L ItemNamet Ljava/lang/String;L Modelt Ljava/lang/String;L this$0t LClass1;xp A��� t
    Claw Hammert Hammert CL550{sr  java.io.NotSerializableException(Vx �� 5   xr  java.io.ObjectStreamExceptiond��k�9��   xr  java.io.IOExceptionl�sde%��   xr  java.lang.Exception��> ; �   xr  java.lang.Throwable��5'9w��   L
    detailMessaget  Ljava/lang/String;xpt  Class1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Problem on reading and writing from from a *.txt file

    I get Problem on reading and writing from from a *.txt file. The following is the read() method...
    The software said the DataInputStream is depreciated. Can anyone help me please?
    public void read()
        File file = new File("C://Documents and Settings//Charles//My Documents//Brunel//EE2065//Assignment and Lab//Assignment 4 and Lab 4//data.txt");
        FileInputStream in = null;
        String str = "";
        try
          in = new BufferedReader(file);
          //in = new FileInputStream(file);
          for(;;)
            str = new BufferedReader(in).readLine();
            //str = new DataInputStream(in).readLine();
            if(str == null)
              break;
            System.out.print(str);
        in.close();
        catch(IOException e)
            System.err.println("execution error: " +e);
      }

    Thank you for your reply. I have made some change. However, there is an incompetable type found error.
    in = new BufferedReader(new InputStreamReader(in));The following are all of the code.
    public void read()
        File file = new File("C://Documents and Settings//Charles//My Documents//Brunel//EE2065//Assignment and Lab//Assignment 4 and Lab 4//data.txt");
        FileInputStream in = null;
        //BufferedReader in = null;
        String str = "";
        try
          in = new BufferedReader(new InputStreamReader(in));
          //in = new FileInputStream(file);
          for(;;)
            BufferedReader Bstr = new BufferedReader(new InputStreamReader(in));
            //str = new BufferedReader(in).readLine();
            //str = new DataInputStream(in).readLine();
            if(str == null)
              break;
            System.out.print(str);
        in.close();
        catch(IOException e)
            System.err.println("execution error: " +e);

  • Writing HTML data in TEXT File

    I am writing HTML content in TEXT file ...I read it in a string and then write using PrintStream...
    But it writes all content on one line ..I want to write it as it was in source HTML file...

    Perchance, the OP is referring to the lack of carriage returns in his outputted data, and querying where they have absconded to? An analysis of his posts to date reveals that he has read the contents of a File into a String variable, and wants to write the (presumably modified) String back to a file (uncertain as to whether this is the same file or a different one) In the process of outputting to said file, carriage returns previously contained in the original input file are not present in the output. I would hazard a guess that the OP does not want said carriage returns in the String to disappear.
    Is my analysis of the situation correct?
    An example of the code that you have written to date would be of extreme usefulness to us in aiding you in your noble quest.
    Without such a resource, I must rely on my intuition instead.
    Possible places that the carriage returns are being "dropped"
    1 - On reading in. Are you discarding carriage returns while building up your variable?
    2 - On manipulating. Are you processing this line by line, or reading it all into one large variable?
    3 - On output - are you using "print" or "println" in the output?
    I look forward to further correspondence with you sir
    kind regards,
    evnafets

  • Error while writing the data into the file . can u please help in this.

    The following error i am getting while writing the data into the file.
    <bindingFault xmlns="http://schemas.oracle.com/bpel/extension">
    <part name="code">
    <code>null</code>
    </part>
    <part name="summary">
    <summary>file:/C:/oracle/OraBPELPM_1/integration/orabpel/domains/default/tmp/
    .bpel_MainDispatchProcess_1.0.jar/IntermediateOutputFile.wsdl
    [ Write_ptt::Write(Root-Element) ] - WSIF JCA Execute of operation
    'Write' failed due to: Error in opening
    file for writing. Cannot open file:
    C:\oracle\OraBPELPM_1\integration\jdev\jdev\mywork\
    BPEL_Import_with_Dynamic_Transformation\WORKDIRS\SampleImportProcess1\input for writing. ;
    nested exception is: ORABPEL-11058 Error in opening file for writing.
    Cannot open file: C:\oracle\OraBPELPM_1\integration\jdev\jdev\mywork\
    BPEL_Import_with_Dynamic_Transformation
    \WORKDIRS\SampleImportProcess1\input for writing. Please ensure 1.
    Specified output Dir has write permission 2.
    Output filename has not exceeded the max chararters allowed by the
    OS and 3. Local File System has enough space
    .</summary>
    </part>
    <part name="detail">
    <detail>null</detail>
    </part>
    </bindingFault>

    Hi there,
    Have you verified the suggestions in the error message?
    Cannot open file: C:\oracle\OraBPELPM_1\integration\jdev\jdev\mywork\BPEL_Import_with_Dynamic_Transformation\WORKDIRS\SampleImportProcess1\input for writing.
    Please ensure
    1. Specified output Dir has write permission
    2. Output filename has not exceeded the max chararters allowed by the OS and
    3. Local File System has enough space
    I am also curious why you are writing to a directory with the name "..\SampleImportProcess1\input" ?

  • Displaying Array Position not working in case of descending Order?

    Hi,
    I need to display the array position of the sorted array in Descending order. Here is my code.
         int[] in = {5,3,2,7};
              int[] newArr = new int[in.length];
              int[] na = new int[in.length];
              //copying into a new array
              for(int i=0;i<in.length;i++){               
                   newArr[i] = in;     
              // code for descending order
              for(int j=0;j<in.length;j++){
              Arrays.sort(in);
              na[j] = in[in.length-(1+j)];
              }the sorted array will be will be {7,5,3,2} now according to this i need to display the array position of the sorted array which should be {3,0,1,2} i tried to compare newArr[i] with na[j] but am not gettin the result that i should be getting the same comparison is working in case of Ascending Order but not descending. Any suggestions or help will be appreciated.
    Thanks and regards.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    hi,
    what you are doing is correct only, do not put sort method inside the for loop
    and postion is correct also
    int[] in = {5,3,2,7};
            int[] newArr = new int[in.length];
            int[] na = new int[in.length];
            //copying into a new array
            for(int i=0;i<in.length;i++){
                newArr[i] = in;
    Arrays.sort(in);
    // code for descending order
    for(int j=0;j<in.length;j++){
    na[j] = in[(in.length-1)-j];
    System.out.println("Val --> "+na[j]);
    System.out.println("Position --> "+j);

  • How to retrieve arrays from a file.

    If i were to save 5 arrays to a file like this.....
    DataOutputStream output;
         DataInputStream input;
         Date today = new Date();
         String filename = "phonebook";
    private String name[] = {""};
         private String surname[] = {""};
         private String home[] = {""};
         private String work[] = {""};
         private String cell[] = {""};
         try
                   output = new DataOutputStream(new FileOutputStream(filename));
              catch(IOException io)
                   JOptionPane.showMessageDialog(null,"This program could not create a storage location. Please check the disk drive and the tun the program again.","Error",JOptionPane.ERROR_MESSAGE);
                   System.exit(1);
    public void save()
              try
                   for(int i=0; i < name.length; i++)
                        output.writeUTF(name);
                        output.writeUTF(surname[i]);
                        output.writeUTF(work[i]);
                        output.writeUTF(home[i]);
                        output.writeUTF(cell[i]);
                   JOptionPane.showMessageDialog(null,"Data succesfully saved to file.","Information message",JOptionPane.INFORMATION_MESSAGE);
              catch(IOException io)
                   System.exit(1);
         }And then I want to use them again on my startup. How would I go about initialising them back into thier origianl arrays. What i mean is I want the arrays to contain theier previous saved values. Is this possible.
    I tried to do it like this but it wont work. I get no errors. It just wont return and strings at all.try
                   input = new DataInputStream(new FileInputStream(filename));
              catch(IOException io)
                   JOptionPane.showMessageDialog(null,"Could not find the correct file to read data from.","Error",JOptionPane.ERROR_MESSAGE);
              try
                   for(int i=0; i< name.length; i++)
                        name[i]=input.readUTF();
                        surname[i]=input.readUTF();
                        work[i]=input.readUTF();
                        home[i]=input.readUTF();
              cell[i]=input.readUTF();
              catch(IOException io)
              }Or is it better to create a seperate file for each array?
    Edited by: Yucca on Mar 23, 2008 2:24 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Any help here please.
    Edited by: Yucca on Mar 23, 2008 6:34 PM

  • Custom Positive Pay File

    Hi -
    I'm creating a positive pay file for my client (they are on Oracle Applications version 11.5.10.2), all has been successful with altering APXPOPAY, I've set this up under a custom directory and as a custom concurrent program. Users can submit the request for the positive pay file and it works correctly.
    The problem I'm having is the checkbox in Payment Batches (this is under Payables Manager Responsibility) named "Create Positive Pay File", it is still trying to call APXPOPAY instead of the new custom concurrent program I've created. How do I change this form's checkbox option to start the new program instead of the old one?
    Thanks for any help!!!

    I hope d_benhur 's suggestion would work, another workaround would be "not" selecting the check box for creating positive pay file as part of payment batch. You can write a simple pl/sql program to generate the file once the payment batch is over. This would give you freedom of format and any future enhancements.
    Thanks
    Girish

  • Reading and writing to and from a file to a form

    Hi there
    I would like somebody to send me a code example,
    showing me how to reading records from a file to a form,
    and writing records to the same file from the same form.
    I know that I have to use sycronize, but I just have not been
    successful. I can constract forms, go from form to a form,
    do buttons, do text fields. I can even read and write from and
    to files. However I cannot do is write from a file to a form and
    from a form to a file.
    could somebody please explain how this done, and could you
    please give me a code example. All the books seem to either
    deal with forms or with files. None seem to combine both.
    I am sure it is very ease to do if ONLY I knew how!!!
    thank you very much in advance for you help.

    I understand that code and I have used it before, however thanks for
    trying to help me, it is really appreciated. However, that is not my
    problem. I can read and write from a file to the console and vice versa.
    what I cannot do, no matter how hard I try, is to write from a file, and
    output it in.
    I will tell you how far I have got.
    I have a MenuFrame class, this is the code for it:
    package WorkflowApp;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class MenuFrame extends JFrame {
    JMenuBar menuBar1 = new JMenuBar();
    JMenu menuFile = new JMenu();
    JMenuItem menuFileExit = new JMenuItem();
    JMenu menuHelp = new JMenu();
    JMenuItem menuHelpAbout = new JMenuItem();
    JToolBar toolBar = new JToolBar();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    JButton jButton3 = new JButton();
    ImageIcon image1;
    ImageIcon image2;
    ImageIcon image3;
    JLabel statusBar = new JLabel();
    Button button2 = new Button();
    Button button3 = new Button();
    Button button4 = new Button();
    Button button5 = new Button();
    Button button6 = new Button();
    Button button7 = new Button();
    Button button1 = new Button();
    //Construct the frame
    public MenuFrame() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    //Component initialization
    private void jbInit() throws Exception {
    image1 = new ImageIcon(WorkflowApp.MenuFrame.class.getResource("openFile.gif"));
    image2 = new ImageIcon(WorkflowApp.MenuFrame.class.getResource("closeFile.gif"));
    image3 = new ImageIcon(WorkflowApp.MenuFrame.class.getResource("help.gif"));
    this.getContentPane().setLayout(null);
    this.setSize(new Dimension(400, 492));
    this.setTitle("MenuFrame");
    statusBar.setText(" ");
    statusBar.setBounds(new Rectangle(0, 0, 3, 17));
    menuFile.setText("File");
    menuFileExit.setText("Exit");
    menuFileExit.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    fileExit_actionPerformed(e);
    menuHelp.setText("Help");
    menuHelpAbout.setText("About");
    menuHelpAbout.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    helpAbout_actionPerformed(e);
    jButton1.setIcon(image1);
    jButton1.setToolTipText("Open File");
    jButton2.setIcon(image2);
    jButton2.setToolTipText("Close File");
    jButton3.setIcon(image3);
    jButton3.setToolTipText("Help");
    toolBar.setBorder(null);
    toolBar.setBounds(new Rectangle(2, 2, 389, 30));
    button2.setBounds(new Rectangle(217, 62, 135, 44));
    button2.setLabel("Staff Details");
    button2.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    button2_actionPerformed(e);
    button3.setBounds(new Rectangle(26, 127, 135, 44));
    button3.setLabel("Arange Viewing");
    button3.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    button3_actionPerformed(e);
    button4.setBounds(new Rectangle(218, 127, 136, 41));
    button4.setLabel("Valuation");
    button4.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    button4_actionPerformed(e);
    button5.setBounds(new Rectangle(28, 196, 135, 41));
    button5.setLabel("Schedule");
    button6.setBounds(new Rectangle(221, 194, 133, 40));
    button6.setName("button6");
    button6.setLabel("Register Interest");
    button7.setBounds(new Rectangle(31, 266, 133, 42));
    button7.setLabel("Register Offers");
    button1.setBounds(new Rectangle(27, 62, 131, 42));
    button1.setLabel("New Client");
    button1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    button1_actionPerformed(e);
    menuFile.add(menuFileExit);
    menuHelp.add(menuHelpAbout);
    menuBar1.add(menuFile);
    menuBar1.add(menuHelp);
    this.setJMenuBar(menuBar1);
    this.getContentPane().add(statusBar, null);
    this.getContentPane().add(toolBar, null);
    toolBar.add(jButton1);
    toolBar.add(jButton2, null);
    toolBar.add(jButton3, null);
    this.getContentPane().add(button3, null);
    this.getContentPane().add(button5, null);
    this.getContentPane().add(button7, null);
    this.getContentPane().add(button2, null);
    this.getContentPane().add(button4, null);
    this.getContentPane().add(button6, null);
    this.getContentPane().add(button1, null);
    //File | Exit action performed
    public void fileExit_actionPerformed(ActionEvent e) {
    System.exit(0);
    //Help | About action performed
    public void helpAbout_actionPerformed(ActionEvent e) {
    MenuFrame_AboutBox dlg = new MenuFrame_AboutBox(this);
    Dimension dlgSize = dlg.getPreferredSize();
    Dimension frmSize = getSize();
    Point loc = getLocation();
    dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
    dlg.setModal(true);
    dlg.show();
    //Overridden so we can exit on System Close
    protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if(e.getID() == WindowEvent.WINDOW_CLOSING) {
    fileExit_actionPerformed(null);
    void button2_actionPerformed(ActionEvent e) {
    StaffDetails myFrame = new StaffDetails();
    myFrame.show();
    void button3_actionPerformed(ActionEvent e) {
    ArrangeViewing myFrame = new ArrangeViewing();
    myFrame.show();
    void button1_actionPerformed(ActionEvent e) {
    NewClientFrame myFrame = new NewClientFrame();
    myFrame.show();
    // System.exit(1);
    void button4_actionPerformed(ActionEvent e) {
    Valuation myFrame = new Valuation();
    myFrame.show();
    then I have a new form class, this is the code for it
    package WorkflowApp;
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class NewClientFrame extends JFrame {
    Label label1 = new Label();
    Label label2 = new Label();
    Label label3 = new Label();
    Label label4 = new Label();
    Label label5 = new Label();
    Label label6 = new Label();
    Label label7 = new Label();
    Label label8 = new Label();
    Label label9 = new Label();
    Label label10 = new Label();
    TextField textField1 = new TextField();
    TextField textField2 = new TextField();
    TextField textField3 = new TextField();
    TextField textField4 = new TextField();
    TextField textField5 = new TextField();
    TextField textField6 = new TextField();
    TextField textField7 = new TextField();
    TextField textField8 = new TextField();
    TextField textField9 = new TextField();
    TextField textField10 = new TextField();
    Button button1 = new Button();
    Button button2 = new Button();
    //Construct the frame
    public NewClientFrame() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    //Component initialization
    private void jbInit() throws Exception {
    this.getContentPane().setLayout(null);
    this.setSize(new Dimension(411, 488));
    this.setTitle("NewClientFrame ");
    this.addWindowListener(new java.awt.event.WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    this_windowClosing(e);
    label1.setBounds(new Rectangle(21, 23, 110, 23));
    label1.setAlignment(2);
    label1.setText("Assign Number");
    label2.setBounds(new Rectangle(23, 57, 108, 25));
    label2.setAlignment(2);
    label2.setText("Name");
    label3.setBounds(new Rectangle(40, 91, 94, 24));
    label3.setAlignment(2);
    label3.setText("Address 1");
    label4.setBounds(new Rectangle(21, 124, 112, 29));
    label4.setAlignment(2);
    label4.setText("Address 2");
    label5.setBounds(new Rectangle(20, 159, 116, 29));
    label5.setAlignment(2);
    label5.setText("PoscCode");
    label6.setBounds(new Rectangle(18, 197, 119, 26));
    label6.setAlignment(2);
    label6.setText("Telephone");
    label7.setBounds(new Rectangle(25, 228, 112, 26));
    label7.setAlignment(2);
    label7.setText("Other Telephone");
    label8.setBounds(new Rectangle(12, 261, 125, 24));
    label8.setAlignment(2);
    label8.setText("Email Address");
    label9.setBounds(new Rectangle(6, 301, 138, 25));
    label9.setAlignment(2);
    label9.setText("Staff Assigned (Name)");
    label10.setBounds(new Rectangle(22, 341, 124, 23));
    label10.setAlignment(2);
    label10.setText("Staff Assigned (No.)");
    textField1.setBounds(new Rectangle(155, 19, 80, 26));
    textField2.setBounds(new Rectangle(155, 58, 193, 24));
    textField3.setBounds(new Rectangle(156, 90, 192, 25));
    textField4.setBounds(new Rectangle(157, 126, 192, 23));
    textField5.setBounds(new Rectangle(157, 159, 195, 25));
    textField6.setBounds(new Rectangle(157, 194, 195, 26));
    textField7.setBounds(new Rectangle(157, 230, 192, 24));
    textField8.setBounds(new Rectangle(157, 263, 193, 25));
    textField9.setBounds(new Rectangle(157, 303, 196, 24));
    textField10.setBounds(new Rectangle(158, 337, 95, 24));
    button1.setBounds(new Rectangle(23, 398, 144, 34));
    button1.setLabel("Staff Available");
    button2.setBounds(new Rectangle(211, 396, 148, 34));
    button2.setLabel("Submit Record");
    button2.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    button2_actionPerformed(e);
    this.getContentPane().add(label1, null);
    this.getContentPane().add(label2, null);
    this.getContentPane().add(label3, null);
    this.getContentPane().add(label4, null);
    this.getContentPane().add(label5, null);
    this.getContentPane().add(label6, null);
    this.getContentPane().add(label7, null);
    this.getContentPane().add(label8, null);
    this.getContentPane().add(label9, null);
    this.getContentPane().add(label10, null);
    this.getContentPane().add(textField1, null);
    this.getContentPane().add(textField2, null);
    this.getContentPane().add(textField3, null);
    this.getContentPane().add(textField4, null);
    this.getContentPane().add(textField5, null);
    this.getContentPane().add(textField6, null);
    this.getContentPane().add(textField7, null);
    this.getContentPane().add(textField8, null);
    this.getContentPane().add(textField9, null);
    this.getContentPane().add(textField10, null);
    this.getContentPane().add(button1, null);
    this.getContentPane().add(button2, null);
    public void fileExit_actionPerformed(ActionEvent e) {
    System.exit(0);
    // exit(this);
    // close();
    //Overridden so we can exit on System Close
    protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if(e.getID() == WindowEvent.WINDOW_CLOSING) {
    System.exit(0);
    void button2_actionPerformed(ActionEvent e) {
    // myFrame.close();
    this.dispose();
    void this_windowClosing(WindowEvent e) {
    this.dispose();
    I also have an about box, staff details, and valuation forms.
    what I am trying to do is for the New client form to be able to read and write from and to a file, and display the info.
    I am working in JBuilder3, a bit out of date I know, but it is the best I can do. Any Ideas how to do this.

Maybe you are looking for

  • How do I null out an item based on a database column before display?

    I am using Apex 3.2 I have an item that is based on database column. My customer wants me to "blank out" the item before it is displayed so the user will have to enter a new value in place of the one that is in the database. I have tried using a "bef

  • Hdmi missing after mountain lion

    I just noticed that under System Preferences, Display my HDMI is missing. 

  • IMac Intel Edirol FA-66 monitoring delay

    I read somewhere else through the discussions that Edirol products can have some problems working with GarageBand. I used it a few times on my iMac Intel with guitar/bass and every time I experienced a monitoring delay after 2-3 mins from instrument

  • Obtaining an oracle.sql.STRUCT through a pooled JDBC connection

    Hello, I am using WebLogic Server 10 and and Oracle 10 and I am trying to obtain a vendor-specific oracle.sql.STRUCT from a ResultSet using a pooled connection defined in Weblogic. I need the vendor-specific object, rather than simply the java.sql.St

  • Import data and ındexes diffrent tablespace

    Assume that I have tablespaces "user_data" and "index_data". If I export the entıre schema and import it into another database, all the data and index are stored in one tablespace.But they are in diffrent tablespaces in the source. What should I do t