writing a file in java

S

sundarmcakms

1)when i try to write a file which was in another file.. it is coming
in same line rather than how it appears in old file..
2) when i set shortcut for menu item using setAccelerator method
when i give the parameter as KeyEvent.VK_N and
KeyEvent.VK_CONTROL
it is coming shift+n
when i give the parameter as KeyEvent.VK_CONTROL and
KeyEvent.VK_N
it is coming something like meta+shift+alt+...
i cant view it fully in menu item..
what i have to do to assign shortcut as ctrl+n?
 
A

Andrew Thompson

1)when i try to write a file which was in another file.. it is coming
in same line rather than how it appears in old file..

Did you have a question? If that question might
be "What is happening to the end-of-line characters?"
then that would depend on the code you did not show
us.
2) when i set shortcut for menu item ...

Given that has nothing to do with saving a file,
(with or without newline chars) I suggest you put
it under a new title. The best group for GUI related
questions is comp.lang.java.gui
 
A

Andreas Leitgeb

1)when i try to write a file which was in another file.. it is coming
in same line rather than how it appears in old file..

Probably suffering from line-end conversion?

Does your file read&write happen on Unix and you
view the file with notepad on a network-drive?

Either use wordpad instead, or ultraedit, or
show us the code for reading&writing, and we can tell
you what to change, so it is written the same way as
the original.

I had no idea about the second question.
 
S

sundarmcakms

file=fc.getSelectedFile();
try{
out=new PrintWriter(file);
}catch(FileNotFoundException fnf)
{
System.out.println(fnf);
}
out.println(ta.getText());
System.out.println(ta.getText());

this is the code i prefer to write in file... it's not coming..
 
S

sundarmcakms

file=fc.getSelectedFile();
try{
out=new PrintWriter(file);
}catch(FileNotFoundException fnf)
{
System.out.println(fnf);
}
out.println(ta.getText());
System.out.println(ta.getText());
 
S

sundarmcakms

file=fc.getSelectedFile();
try{
out=new PrintWriter(file);
}catch(FileNotFoundException fnf)
{
System.out.println(fnf);
}
out.println(ta.getText());
System.out.println(ta.getText());
 
Joined
Mar 28, 2011
Messages
1
Reaction score
0
Я не с могу написать файл .Я хочу целый код написать файл
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top