Very slow painting while reading and writing doubles into file
for 15MB length file i = 7662080
for 50MB length file i = 12414368
Part of Code for writing into file follows like this:
try{
fos = new FileOutputStream("Angel.txt");
File f = new File("Angel.txt");
if(f.length() >=4)
f.delete();
fos = new FileOutputStream("Angel.txt");
dos = new DataOutputStream(new BufferedOutputStream(fos,1000000));
int x=0;
double y_last, y_new;
for(int j=0 ;j<i ;j++)
if(some condition)
y_new = ....;
try{
//previously in vectors
y_last = y_new;
vect.add(new Line2D.Double(x, y_last, x, y_new)_;
dos.writeDouble(y_new);
}catch(Exception e){System.out.println(e);}
dos.close();
fos.close();
x++;
}catch(Exception excp){System.out.println(excp);}
part of code for reading from file follows like this:
public void paint(Graphics g)
try{
double y1, y2 =0;
Line2D.Double doub;
raf = new RandomAccessFile("Angel.txt","r");
dis = new DataInputStream(new BufferedInputStream(new FileInputStream(raf.getFD(),1000000)));
raf.seek((rect.x*8));
for (int i = 0/any value; (i < value as per choice); i++)
g2.setStroke(new BasicStroke(0)); //2
y1 = y2;
y2 =dis.readDouble();
doub=new Line2D.Double(i,y1,i,y2);
g2.draw(doub);
dis.close();
raf.close();
}catch(Exception excp){System.out.println(excp);}
I tried using Object Streams but NotSerializable Exception is thrown as Line2D.Double objects
are not serialized.
Any idea to make reading and writing into file specially from MB files faster is appreciated.
Why are you reading in the file in the paint method ?
Create your data once before painting.
I think you should explain what is your goal and what behavior you want.
Denis
Similar Messages
-
Reading and writing from a file
I am trying to read and write to a file so that I may store an array of string and a double in my application, but I have come upon a couple of problems; first when I put my file path into the path constant it will say that the file is not there ever though it is (so I have to force the issue and when the application asks for a file I have to browse and add the files), secondly when I run the program and it reads from the file it does not display the strings or doubles immediately instead I have to hit the submit button and than they finally come up, thirdly when I reset my values in the .txt files and put in my string and double and hit submit the array jumps one spot and starts at the index of 1 (array[1]) if anyone can help I would appreciate it a lot.
here is my code:
Harold Timmis
[email protected]
Orlando,Fl
*Kudos always welcome
Solved!
Go to Solution.
Attachments:
testingfileIO.vi 30 KB
double.txt 1 KB
string.txt 1 KBHarold Timmis wrote:
I am trying to read and write to a file so that I may store an array of string and a double in my application, but I have come upon a couple of problems; first when I put my file path into the path constant it will say that the file is not there ever though it is (so I have to force the issue and when the application asks for a file I have to browse and add the files),
I don't see that behavior at all about forcing the issue. Why are you using Not a Path constants? Why not turn those constants into controls you put on your front panel?
secondly when I run the program and it reads from the file it does not display the strings or doubles immediately instead I have to hit the submit button and than they finally come up,
Put your array indicators before your event structure rather than after. Think dataflow. The code pauses at the event structure waiting for an even to fire. Only when it does (such as hitting the submit button) does the data get written to the array indicators.
thirdly when I reset my values in the .txt files and put in my string and double and hit submit the array jumps one spot and starts at the index of 1 (array[1]) if anyone can help I would appreciate it a lot.
I don't see this behavior either. How come your double.txt file has names in it, and your string.txt file has doubles in it? -
Reading and Writing large Excel file using JExcel API
hi,
I am using JExcelAPI for reading and writing excel file. My problem is when I read file with 10000 records and 95 columns (file size about 14MB), I got out of memory error and application is crashed. Can anyone tell me is there any way that I can read large file using JExcelAPI throug streams or in any other way. Jakarta POI is also showing this behaviour.
Thanks and advanceSorry when out of memory error is occurred no stack trace is printed as application is crashed. But I will quote some lines taken from JProfiler where this problem is occurred:
reader = new FileInputStream(new File(filePath));
workbook = Workbook.getWorkbook(reader);
*sheeet = workbook.getSheet(0);* // here out of memory error is occured
JProfiler tree:
jxl.Workbook.getWorkBook
jxl.read.biff.File
jxl.read.biff.CompoundFile.getStream
jxl.read.biff.CompoundFile.getBigBlockStream Thanks -
Reading and writing non-English files
Hi there..
I wonder if anyone can tell me how to read and write non-English language files like French or Arabic files...
Im also interested in knowing how can i convert from Unicode to ASCII and vice versa..
thanx.. Mouradhi there ..
thanx for ur cooperation .. but actually i have tried the following code and it didnt work; so, im looking for more help :)
esp. if there are any notes about the files themselves for example;
by the way i used Notepad files in unicode format..
my code is :
import java.io.*;
public class MainClass {
public static void main(String args[]){
String inputfile = "arabic.txt";
String outfile = "outfile.txt";
try{
RandomAccessFile raf = new RandomAccessFile(inputfile, "r");
InputStreamReader isr = new InputStreamReader(
new FileInputStream(inputfile), "Cp1256");
OutputStreamWriter osw = new OutputStreamWriter(
new FileOutputStream(outfile), "Cp1256");
for(int i=0; i<raf.length(); i++)
osw.write(isr.read());
osw.close();
}catch(UnsupportedEncodingException uee){
System.out.println("UEException: "+ uee.getMessage());
}catch(FileNotFoundException fnfe){
System.out.println("FNFException: "+ fnfe.getMessage());
}catch(IOException ioe){
System.out.println("IOException: "+ ioe.getMessage());
thanx again..Mourad -
Running OSX 10.9.3 2.5 Ghz i5 16GB ram. No other known issuses. while importing some images from my external 1TB drive my son unplugged the USB cable. I got the error that a disk was not properly ejected and the program Lightroom 4 also gave an error. I closed both notifications and restarted my comp, no recognition of the drive, shut down the comp and unplugged the external. Still no recognition in finder, system information sees the drive, Disk Utility sees the drive but keeps giving me the error "disk could not be unmounted." what else can I try before I have to book an appointment??
Hey there Sirtuc,
It sounds like your external drive is not being recognized after a restart of your computer after the USB cord was unexpectedly disconnected. Restarting is the first thing I would have done as well, and next I would reset my SMC then my PRAM and re test the issue:
Intel-based Macs: Resetting the System Management Controller (SMC)
http://support.apple.com/kb/ht3964
Then:
About NVRAM and PRAM
http://support.apple.com/kb/HT1379
Thank you for using Apple Support Communities.
Take care,
Sterling -
READING AND WRITING FROM A FILE(WRITTEN IN ANOTHER LANGUAGE)
# Comment
INTEGER Declares integer type variable
STRING Declares string type variable
LET Assigns a variable
CALCULATE Performs an arithmetic calculation
PRINT Writes data to the console
PRINTLN As print, but followed by a new line
END Terminates the program
Each line of the program must begin with one of these words, and the language should not be case sensitive.
Tim Brailsford, 2007
G64ICP
COMMENT
Any line beginning with the # character is completely ignored.
Example:
# ignore this line!
INTEGER
The INTEGER reserved word declares an Integer variable, and assigns a default value of 0 to it.
Example:
INTEGER myInt
This example is equivalent to the Java statment "int myInt=0;"
STRING
The STRING reserved word declares a String variable, and assigns an empty string to it.
Example:
STRING myString
This is equivalent to the Java statement "String myString;"
LET
This assigns values to variables (either integers, or strings enclosed
in double quotes).
Examples:
LET myInt=42
LET myString="Hello World!"
CALCULATE
This performs numeric calculations upon values or variables, and assigns the result to a variable (which must have
been declared earlier). Four operators are supported: + *
and / (for addition, subtraction multiplication and
integer division respectively).
Examples:
CALCULATE myInt=2*2
CALCULATE myInt=myInt+24
CALCULATE myInt=intA/intB
PRINT and PRINTLN
These words both print to the console the
only difference being that PRINTLN appends a new line (as does
System.out.println in Java). These can print either text provided as an argument, or variables (string or integer).
Examples:
PRINTLN "Hello World!"
PRINT myString
PRINTLN myInt
END
This terminates the program, and prints a message to that effect.
TPL Example
To the left is an example TPL input file , to
calculate the factorial of 5. This should produce
an output similar to that shown overleaf (except
that calculates the factorial of 10).
# A TPL Program to calculate the factorial of 5
INTEGER myInt
INTEGER factorial
STRING myString
LET mystring="Factorial Program"
LET myInt=5
CALCULATE factorial=myInt*4
CALCULATE factorial=factorial*3
CALCULATE factorial=factorial*2
Tim Brailsford, 2007
G64ICP
PRINTLN mystring
PRINTLN
PRINT "The factorial of "
PRINT myInt
PRINT " is "
PRINTLN factorial
END
Documentation
Document your code by writing instructions explaining how to run it, listing all of the files you have submitted,
and specifying any limitations (eg you might want to say what platforms you would expect it to run on, and what
platforms you have tested it on). This document should be written as a plain text file (ie ASCII � MS Word binary
files are not acceptable) � and this file should be called README.TXT. This file should constitute the user
manual of your program, and should explain exactly how to use your program.
The README file should be the user manual for your language as implemented.
NB:
I want it to read values from the file as given above and execute the answer in the command prompt( as intented in the file above)
Thanks
Alam IkennaHai I have one doubt in doing other peoples homework for them. Why bother?
-
hi there
anyone can help me on how to write and read from a file? how can i read one string at a time instead of a char. thank you.Use the StringTokenizer to break up the line
File newFile = new File("text.txt");
BufferedReader in = new BufferedReader(new FileReader (newFile));
String line;
while((line = in.readLine()) != null){
StringTokenizer st = new StringTokenizer(inputLine, " ");
while(st.hasMoreTokens()){
// do something with the token
// e.g:
// String lc = st.nextToken().toLowerCase()
hope that helps -
Issue with Reading and Writing to a File
Hello all,
I'm having trouble when I run the following example;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.IOException;
public class ReadWriteTextFile {
private static void doReadWriteTextFile() {
try {
// input/output file names
String inputFileName = "README_InputFile.txt";
String outputFileName = "ReadWriteTextFile.out";
// Create FileReader Object
FileReader inputFileReader = new FileReader(inputFileName);
FileWriter outputFileReader = new FileWriter(outputFileName);
// Create Buffered/PrintWriter Objects
BufferedReader inputStream = new BufferedReader(inputFileReader);
PrintWriter outputStream = new PrintWriter(outputFileReader);
outputStream.println("+---------- Testing output to a file ----------+");
outputStream.println();
String inLine = null;
while ((inLine = inputStream.readLine()) != null) {
outputStream.println(inLine);
outputStream.println();
outputStream.println("+---------- Testing output to a file ----------+");
outputStream.close();
inputStream.close();
} catch (IOException e) {
System.out.println("IOException:");
e.printStackTrace();
public static void main(String[] args) {
doReadWriteTextFile();
}Im getting the error
java.io.FileNotFoundException: README_InputFile.txt (The system cannot find the file specified)However the file README_InputFile.txt is definately in the same folder as the class file. So why is this not working?
Any help would be greatly appreciated.
JazSorry you've lost me. All I get are error messages
when I try to compile that statement. What am I
missing?I don't know, it should work:
import java.io.*;
public class Test {
public static void main(String[] args) throws
IOException {
System.out.println(new
File(".").getCanonicalPath());
Sorry I forgot to add the "throws IOException" bit. It works and told me that the path is;
C:\Documents and Settings\Jaz\workspace\Tutorial
I've amended the code so it now looks like this;
String inputFileName = "C:/Documents and Settings/Jaz/workspace/TutorialREADME_InputFile.out";
String outputFileName = "C:/Documents and Settings/Jaz/workspace/TutorialReadWriteTextFile.out";but I still get the error below even though the files are present in that directory;
IOException:
java.io.FileNotFoundException: C:\Documents and Settings\Jaz\workspace\TutorialREADME_InputFile.out (The system cannot find the file specified) -
Need Help: UTL_FILE Reading and Writing to Text File
Hello I am using version 11gR2 using the UTL_FILE function to read from a text file then write the lines where it begins with word 'foo' and end my writing to the text file where the line with the word 'ZEN' is found. Now, I have several lines that begin with 'foo' and 'ZEN' Which make for one full paragraph, and in this paragraph there's a line that begins with 'DE4.2'. Therefore,
I need to write all paragraphs that include the line 'DE4.2' in their beginning and ending lines 'foo' and 'ZEN'
FOR EXAMPLE:
FOO/234E53LLID
THIS IS MY SECOND LINE
THIS IS MY THIRD LINE
DE4.2 THIS IS MY FOURTH LINE
THIS IS MY FIFTH LINE
ZEN/DING3434343
FOO/234E53LLID
THIS IS MY SECOND LINE
THIS IS MY THIRD LINE
THIS IS MY FIFTH LINE
ZEN/DING3434343
I am only interested in writing the first paragraph tha includes line DE4.2 in one of ther lines Not the Second paragraph that does not include the 'DE4.2'
Here's my code thus far:
CREATE OR REPLACE PROCEDURE my_app2 IS
infile utl_file.file_type;
outfile utl_file.file_type;
buffer VARCHAR2(30000);
b_paragraph_started BOOLEAN := FALSE; -- flag to indicate that required paragraph is started
BEGIN
-- open a file to read
infile := utl_file.fopen('TEST_DIR', 'mytst.txt', 'r');
-- open a file to write
outfile := utl_file.fopen('TEST_DIR', 'out.txt', 'w');
-- check file is opened
IF utl_file.is_open(infile)
THEN
-- loop lines in the file
LOOP
BEGIN
utl_file.get_line(infile, buffer);
--BEGINPOINT APPLICATION
IF buffer LIKE 'foo%' THEN
b_paragraph_started := TRUE;
END IF;
--LOOK FOR GRADS APPS
IF b_paragraph_started AND buffer LIKE '%DE4%' THEN
utl_file.put_line(outfile,buffer, FALSE);
END IF;
--ENDPOINT APPLICATION
IF buffer LIKE 'ZEN%' THEN
b_paragraph_started := FALSE;
END IF;
utl_file.fflush(outfile);
EXCEPTION
WHEN no_data_found THEN
EXIT;
END;
END LOOP;
END IF;
utl_file.fclose(infile);
utl_file.fclose(outfile);
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20099, 'Unknown UTL_FILE Error');
END my_app2;
When I run this code I only get one line: DE4.2 I AM MISSING THE ENTIRE PARAGRAPH
PLEASE ADVISE...Hi,
Look at where you're calling utl_file.put_line. The only time you're writing anything is immediately after you find the the key word 'DE4', and then you're writing just that line.
You need to store the entire paragraph, and when you reach the end of the paragraph, write the whole thing only if you found the key word, like this:
CREATE OR REPLACE PROCEDURE my_app2 IS
TYPE line_collection
IS TABLE OF VARCHAR2 (30000)
INDEX BY BINARY_INTEGER;
infile utl_file.file_type;
outfile utl_file.file_type;
input_paragraph line_collection;
input_paragraph_cnt PLS_INTEGER := 0; -- Number of lines stored in input_paragraph
b_paragraph_started BOOLEAN := FALSE; -- flag to indicate that required paragraph is started
found_key_word BOOLEAN := FALSE; -- Does this paragraph contain the magic word?
BEGIN
-- open a file to read
infile := utl_file.fopen('TEST_DIR', 'mytst.txt', 'r');
-- open a file to write
outfile := utl_file.fopen('TEST_DIR', 'out.txt', 'w');
-- check file is opened
IF utl_file.is_open(infile)
THEN
-- loop lines in the file
LOOP
BEGIN
input_paragraph_cnt := input_paragraph_cnt + 1;
utl_file.get_line (infile, input_paragraph (input_paragraph_cnt));
--BEGINPOINT APPLICATION
IF LOWER (input_paragraph (input_paragraph_cnt)) LIKE 'foo%' THEN
b_paragraph_started := TRUE;
END IF;
--LOOK FOR GRADS APPS
IF b_paragraph_started
THEN
IF input_paragraph (input_paragraph_cnt) LIKE '%DE4%'
THEN
found_key_word := TRUE;
END IF;
--ENDPOINT APPLICATION
IF input_paragraph (input_paragraph_cnt) LIKE 'ZEN%' THEN
b_paragraph_started := FALSE;
IF found_key_word
THEN
FOR j IN 1 .. input_paragraph_cnt
LOOP
utl_file.put_line (outfile, input_paragraph (j), FALSE);
END LOOP;
END IF;
found_key_word := FALSE;
input_paragraph_cnt := 0;
END IF;
ELSE -- paragraph is not started
input_paragraph_cnt := 0;
END IF;
EXCEPTION
WHEN no_data_found THEN
EXIT;
END;
END LOOP;
END IF;
utl_file.fclose (infile);
utl_file.fclose (outfile);
--EXCEPTION
-- WHEN OTHERS THEN
-- raise_application_error(-20099, 'Unknown UTL_FILE Error');
END my_app2;
SHOW ERRORSIf you don't have an EXCEPTION section, the default error handling will print an error message, spcifying exactly what the error was, and which line of your code caused the error. By using your own EXCEPTION section, you're hiding all that information. I admit, the error messages aren't always as informative as we'd like, but they're never less informative than "Unknown UTL_FILE Error'. Don't use your own EXCEPTION handling unless you can improve on the default.
Remember that anything inside quotes is case-sensitive. If your file contains upper-case 'FOO', then it won't be "LIKE 'foo%' ".
Edited by: Frank Kulash on Dec 7, 2011 1:35 PM
You may have noticed that this site normally doesn't display multiple spaces in a row.
Whenever you post formatted text (such as your code) on this site, type these 6 characters:
\{code}
(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing. -
Reading and writing u16 binary file to a new file
Hello all,
a very simple thing that I just don't seem to be able to figure out. I have a file containing 1024bytes of unsigned 16bit words. I can read it successfully with the right value being displayed. But then I try to write these values to a new file, I can no longer read the same value (in fact it's all grayed out 0) from the newly written file. The newly written file has the right size 1024 bytes, but I don't seem to obtain the right information. I made sure the endian are the same, little-endian.
Attached is my basic VI, and the .dat file is the file containing the binary information.
I'm not using copy file because once I get this figure out, I'll need to append more of the Scan.dat file to one single file.
Thank you!
Solved!
Go to Solution.
Attachments:
read_write_binary_u16.zip 11 KBI would put some wait time between the write and the read. It may be a good idea to actually close the file in between.
I have a feeling that you may not have allowed enough time to actually have the file written out before you read it again. That or since it is still open, the file pointer is at the end of the file and you are trying to read all the bytes starting at the end, which means you get nothing.
Not sure of the exact issue, but those two things comes to mind. -
UTL_FILE: Reading and Writing client-side Files
Hi All,
Please tell me how to read & write UTL_FILE at client-side
RegardsAnd you need this XML to be generated on and read from a client machine? You can't generate the file on the server, move it to the new server, and import it?
If you need to generate files on the client machine, the client application would have to do the file I/O. Java has a number of libraries for generating XML and parsing XML that could be used, for example, but that implies that a Java application has been deployed to the client machine.
Justin -
Quickest method for reading and writing files
Hi
I need help regarding file operations.(Reading and Writing). Currently I am using BufferedReader and BufferedWriter to read and write files. But the files (XML) are very huge files(from 30 -50 mb). This is slowing the application to a great extent. Is there any other approach to perform the above mentioned operations on XML files in a fast manner.
Thank You
Mansoor.Hi
Can u let me know how to use the java.nio pavkage for primitve data types(int,float..., boolean). I have tried it but found no success.
Thank You
Mansoor -
Very slow processing on LSMW and IFS access
Hi all,
we have a very slow processing on LSMW and IFS access. I believe it was slow all the time in the past. This LSMW transaction only converts some data, which are stored in a flat file in the IFS and stores it again into a flat file in the IFS. It is reading the data from IFS and writing again the data into the IFS.
IFS is not fast, I know. But do you have an similar experiences with such LOAD ?!
R/3 Enterprise 4.70 shows with transaction SM50 the following lon running job:
4 BGD 65988 waiting Yes
5 BGD 65989 waiting Yes
6 DIA 85421 running Yes 1 SAPLTHFB 100 USER1
7 DIA 65993 running Yes 11500 /1CADMC/SA 100 USER2
8 DIA 65994 waiting Yes
9 DIA 65995 waiting Yes
The WRKACTJOB Display shows:
This means for me the job is not doing so much with the database. Only 439 I/O's in 21 minutes. This is nothing. I have tried to give to this job Priority 19, but this is not the reason, the job is not going faster.
Work with Active Jobs
02.07.08 1
CPU %: 89,0 Elapsed time: 00:21:25 Active jobs: 895
Subsystem/Job Type Pool Pty CPU Int Rsp AuxIO CPU %
WP06 BCI 2 20 395,2 136 0,0
WP07 BCI 2 19 10274,0 439 12,7
WP08 BCI 2 20 1156,0 8 0,0
WP09 BCI 2 20 874,3 6 0,0
The WRKSYSSTS Display shows: This means for me, the is no memory lack.
Sys Pool Reserved Max ----DB----- --Non-DB--- Act- Wait- Act-
Pool Size M Size M Act Fault Pages Fault Pages Wait Inel Inel
1 5000,00 1448,43 +++++ 0,0 0,0 0,4 0,5 94,9 0,0 0,0
2 60340,00 44,65 3500 51,6 6335 113,4 364,1 7887 0,0 0,0
3 128,00 0,00 10 0,0 1,3 0,2 0,8 17,2 0,0 0,0
The WRKDSKSTS Display shows no problem in DASD.
I/O Request Read Write Read Write %
Rqs Size (K) Rqs Rqs (K) (K) Busy
11,5 12,4 3,0 8,4 13,2 12,1 2
13,2 10,2 1,5 11,6 7,0 10,6 1
10,6 8,8 3,5 7,0 8,2 9,2 2
13,8 12,4 4,2 9,5 10,1 13,5 2
8,3 71,3 7,5 0,8 78,4 7,4 5
17,7 123,6 17,5 0,2 125,2 4,0 9
27,0 83,1 25,7 1,3 87,1 4,3 10
26,9 95,0 25,6 1,3 99,6 5,8 9
16,9 115,4 16,2 0,7 120,3 4,0 8
37,3 116,7 37,0 0,2 117,3 18,0 13
21,4 94,0 20,3 1,0 98,6 6,2 7
12,7 72,8 11,5 1,1 77,6 26,8 6
13,5 85,1 12,3 1,1 92,0 12,8 5
Any idea, here ???
best regrads,
Carsten Schulz
Teamleader SAP-Basis, ebmpapst Mulfingen, GemanyHi together,
thanks for answering so fast.
The jobs read from the sysbas-IFS /usr/sap/a/b/ and writes to /usr/sap/SID/DVEBMGS00/work/ also in the sysbas-IFS.This IFS is not remote. Not through the QfileSrv.400 mechanism.
And yes, we have a HA solution. We have two IASP's on two different iSeries and are using XSM to mirror the data.
I have tried to increase the speed by switching off the XSM mirroring, but the speed does not increase. Sorry.
best regards,
Carsten Schulz -
Firefox 12 is very slow to load pages and if two tabs are opening it lags.
Firefox 12 is very slow to load pages and if two tabs are opening it lags. I've tried everything (e.g virus, defrag, I've created a new profile in "run", etc). I've had my router/line etc all checked and after 2 weeks of cleaning/testing etc its all pointing to Firefox as the problem. Please help as it's driving me nuts.
I have the exact same problem.
Not only does it load pages very slowly, sometimes the page will stop for a good 45 seconds and stop loading, only to finish it much later.
Something is wrong with Firefox 12, it shouldn't be this slow.
How is that each version is progressively worse than the one before it?.
Stop releasing so many versions Mozilla, release one that works and build from there. -
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
-
My camera doesn't work, it says its not connected.
Hi, i got a macbook air, and its been a while since my camera doesnt work, its says its not connected.
-
Hi Gurus Would you pl advise how can we find out a particular table name for a particular field as we do not know which fields are there in which table? Pl help.
-
Dispatching and listening events in different swf in flex
I have two swf files. 1.Main Application swf file. 2.Module swf file If i dispatch an event in main application swf file i am unable to listen in module swf file. Can any one propose me a solution for this.
-
Hi All, How different the time entry via CATS in R/3 is for concurrently employeed persons v/s regular employees. I am trying to figure out how time entry for concurrently employeed persons takes place in R/3 (CATS). Regards, Mark
-
Cisco wlc and steel belted radius
we have cisco wlc controller that have two ssid one for user and one for guest we need the user in ssid 1 take user name and password from user group in active directory through steel belted radiu please send to me any integrated guide between c