GUI Application for writing notesWriting a list to a file with PythonWriting files in Node.jsHow to write to file in Ruby?How do I create a file and write to it in Java?How to write content on a text file using java?Correct way to write line to file?Java Inventory Program problemsClone a Singleton objectwhy spill failure happens for Custom Data Type in HadoopJava - Method executed prior to Default Constructor

Is the claim "Employers won't employ people with no 'social media presence'" realistic?

Do I have an "anti-research" personality?

What happened to Captain America in Endgame?

Is it idiomatic to construct against `this`

'It addicted me, with one taste.' Can 'addict' be used transitively?

How can I get this effect? Please see the attached image

"Hidden" theta-term in Hamiltonian formulation of Yang-Mills theory

Can someone publish a story that happened to you?

How would 10 generations of living underground change the human body?

What happens to Mjolnir (Thor's hammer) at the end of Endgame?

How to limit Drive Letters Windows assigns to new removable USB drives

How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?

Elements that can bond to themselves?

Critique of timeline aesthetic

How to have a sharp product image?

How did Captain America manage to do this?

Was there a shared-world project before "Thieves World"?

Why does Mind Blank stop the Feeblemind spell?

Can we say “you can pay when the order gets ready”?

What are the steps to solving this definite integral?

Coordinate my way to the name of the (video) game

Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?

Why does nature favour the Laplacian?

Does tea made with boiling water cool faster than tea made with boiled (but still hot) water?



GUI Application for writing notes


Writing a list to a file with PythonWriting files in Node.jsHow to write to file in Ruby?How do I create a file and write to it in Java?How to write content on a text file using java?Correct way to write line to file?Java Inventory Program problemsClone a Singleton objectwhy spill failure happens for Custom Data Type in HadoopJava - Method executed prior to Default Constructor






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








-4















I am developing a GUI application that lets you add pieces of text to a note.txt.
The problem that I have is when I try to add a text it only adds a "0" and if you try to run the project it crashes. In the past it did not even recognise that the file even exist (somehow I got that fixed).



Figured out that the problem is here private void readAllNotes() class.



Would be grateful is someone could help.



here is my repository of the project on github, feel free to give advice on any part of the code.
https://github.com/justcain/GUI-Easy-snippets



public class AllNotes extends CommonCode 


ArrayList<Note> allNotes = new ArrayList<>();
private String crse = "";
private int maxID = 0;

AllNotes()
readAllNotes();


public final int getMaxID()
maxID++;
return maxID;


private void readAllNotes()
ArrayList<String> readNotes = new ArrayList<>();

readNotes = readTextFile(appDir + fileSeparator + "\Notes.txt");
//System.out.println(readNotes.get(0));

if (!"File not found".equals(readNotes.get(0)))
allNotes.clear();
for (String str : readNotes)
String[] tmp = str.split("t");
System.out.println(str);

Note n = new Note();
n.setNoteID(Integer.parseInt(tmp[0]));
n.setCourse(tmp[1]);
n.setDayte(tmp[2]);
n.setNote(tmp[3]);

allNotes.add(n);

/*int nid = Integer.parseInt(tmp[0]);
Note n = new Note(nid, tmp[1], tmp[2], tmp[3]);
allNotes.add(n);

if (nid > maxID)
maxID = nid;
*/



maxID++;


public void addNote(int maxID, String course, String note)
Note myNote = new Note(maxID, course, note);
allNotes.add(myNote);
writeAllNotes();


public ArrayList<Note> getAllNotes()
return allNotes;


private void writeAllNotes()
String path = appDir + fileSeparator + "\Notes.txt";
ArrayList<String> writeNote = new ArrayList<>();

allNotes.stream().map((n) ->
String tmp = n.getNoteID() + "t";
tmp += n.getCourse() + "t";
tmp += n.getDayte() + "t";
tmp += n.getNote();
return tmp;
).forEachOrdered((tmp) ->
writeNote.add(tmp);
);
try
//FileWriter writer = new FileWriter("path");
//BufferedWriter bw = new BufferedWriter(writer);
writeTextFile(path, writeNote);
catch (IOException e)
System.out.println("Problem! " + path);



public String searchAllNotesByKeyword(String noteList, int i, String s)
if (i == allNotes.size())
return noteList;


if (allNotes.get(i).getNote().contains(s))
noteList += allNotes.get(i).getNote() + "n";


return searchAllNotesByKeyword(noteList, i + 1, s);












share|improve this question
























  • Never mind. Fixed the code

    – justcain
    Mar 22 at 17:49











  • "Never mind. Fixed the code" Please either enter the solution below, or delete the question. As it stands, this Q(&A) brings no value to future visitors. BTW - you mention a GUI. If Swing, look at JTextComponent.write(Writer).

    – Andrew Thompson
    Mar 23 at 2:07


















-4















I am developing a GUI application that lets you add pieces of text to a note.txt.
The problem that I have is when I try to add a text it only adds a "0" and if you try to run the project it crashes. In the past it did not even recognise that the file even exist (somehow I got that fixed).



Figured out that the problem is here private void readAllNotes() class.



Would be grateful is someone could help.



here is my repository of the project on github, feel free to give advice on any part of the code.
https://github.com/justcain/GUI-Easy-snippets



public class AllNotes extends CommonCode 


ArrayList<Note> allNotes = new ArrayList<>();
private String crse = "";
private int maxID = 0;

AllNotes()
readAllNotes();


public final int getMaxID()
maxID++;
return maxID;


private void readAllNotes()
ArrayList<String> readNotes = new ArrayList<>();

readNotes = readTextFile(appDir + fileSeparator + "\Notes.txt");
//System.out.println(readNotes.get(0));

if (!"File not found".equals(readNotes.get(0)))
allNotes.clear();
for (String str : readNotes)
String[] tmp = str.split("t");
System.out.println(str);

Note n = new Note();
n.setNoteID(Integer.parseInt(tmp[0]));
n.setCourse(tmp[1]);
n.setDayte(tmp[2]);
n.setNote(tmp[3]);

allNotes.add(n);

/*int nid = Integer.parseInt(tmp[0]);
Note n = new Note(nid, tmp[1], tmp[2], tmp[3]);
allNotes.add(n);

if (nid > maxID)
maxID = nid;
*/



maxID++;


public void addNote(int maxID, String course, String note)
Note myNote = new Note(maxID, course, note);
allNotes.add(myNote);
writeAllNotes();


public ArrayList<Note> getAllNotes()
return allNotes;


private void writeAllNotes()
String path = appDir + fileSeparator + "\Notes.txt";
ArrayList<String> writeNote = new ArrayList<>();

allNotes.stream().map((n) ->
String tmp = n.getNoteID() + "t";
tmp += n.getCourse() + "t";
tmp += n.getDayte() + "t";
tmp += n.getNote();
return tmp;
).forEachOrdered((tmp) ->
writeNote.add(tmp);
);
try
//FileWriter writer = new FileWriter("path");
//BufferedWriter bw = new BufferedWriter(writer);
writeTextFile(path, writeNote);
catch (IOException e)
System.out.println("Problem! " + path);



public String searchAllNotesByKeyword(String noteList, int i, String s)
if (i == allNotes.size())
return noteList;


if (allNotes.get(i).getNote().contains(s))
noteList += allNotes.get(i).getNote() + "n";


return searchAllNotesByKeyword(noteList, i + 1, s);












share|improve this question
























  • Never mind. Fixed the code

    – justcain
    Mar 22 at 17:49











  • "Never mind. Fixed the code" Please either enter the solution below, or delete the question. As it stands, this Q(&A) brings no value to future visitors. BTW - you mention a GUI. If Swing, look at JTextComponent.write(Writer).

    – Andrew Thompson
    Mar 23 at 2:07














-4












-4








-4








I am developing a GUI application that lets you add pieces of text to a note.txt.
The problem that I have is when I try to add a text it only adds a "0" and if you try to run the project it crashes. In the past it did not even recognise that the file even exist (somehow I got that fixed).



Figured out that the problem is here private void readAllNotes() class.



Would be grateful is someone could help.



here is my repository of the project on github, feel free to give advice on any part of the code.
https://github.com/justcain/GUI-Easy-snippets



public class AllNotes extends CommonCode 


ArrayList<Note> allNotes = new ArrayList<>();
private String crse = "";
private int maxID = 0;

AllNotes()
readAllNotes();


public final int getMaxID()
maxID++;
return maxID;


private void readAllNotes()
ArrayList<String> readNotes = new ArrayList<>();

readNotes = readTextFile(appDir + fileSeparator + "\Notes.txt");
//System.out.println(readNotes.get(0));

if (!"File not found".equals(readNotes.get(0)))
allNotes.clear();
for (String str : readNotes)
String[] tmp = str.split("t");
System.out.println(str);

Note n = new Note();
n.setNoteID(Integer.parseInt(tmp[0]));
n.setCourse(tmp[1]);
n.setDayte(tmp[2]);
n.setNote(tmp[3]);

allNotes.add(n);

/*int nid = Integer.parseInt(tmp[0]);
Note n = new Note(nid, tmp[1], tmp[2], tmp[3]);
allNotes.add(n);

if (nid > maxID)
maxID = nid;
*/



maxID++;


public void addNote(int maxID, String course, String note)
Note myNote = new Note(maxID, course, note);
allNotes.add(myNote);
writeAllNotes();


public ArrayList<Note> getAllNotes()
return allNotes;


private void writeAllNotes()
String path = appDir + fileSeparator + "\Notes.txt";
ArrayList<String> writeNote = new ArrayList<>();

allNotes.stream().map((n) ->
String tmp = n.getNoteID() + "t";
tmp += n.getCourse() + "t";
tmp += n.getDayte() + "t";
tmp += n.getNote();
return tmp;
).forEachOrdered((tmp) ->
writeNote.add(tmp);
);
try
//FileWriter writer = new FileWriter("path");
//BufferedWriter bw = new BufferedWriter(writer);
writeTextFile(path, writeNote);
catch (IOException e)
System.out.println("Problem! " + path);



public String searchAllNotesByKeyword(String noteList, int i, String s)
if (i == allNotes.size())
return noteList;


if (allNotes.get(i).getNote().contains(s))
noteList += allNotes.get(i).getNote() + "n";


return searchAllNotesByKeyword(noteList, i + 1, s);












share|improve this question
















I am developing a GUI application that lets you add pieces of text to a note.txt.
The problem that I have is when I try to add a text it only adds a "0" and if you try to run the project it crashes. In the past it did not even recognise that the file even exist (somehow I got that fixed).



Figured out that the problem is here private void readAllNotes() class.



Would be grateful is someone could help.



here is my repository of the project on github, feel free to give advice on any part of the code.
https://github.com/justcain/GUI-Easy-snippets



public class AllNotes extends CommonCode 


ArrayList<Note> allNotes = new ArrayList<>();
private String crse = "";
private int maxID = 0;

AllNotes()
readAllNotes();


public final int getMaxID()
maxID++;
return maxID;


private void readAllNotes()
ArrayList<String> readNotes = new ArrayList<>();

readNotes = readTextFile(appDir + fileSeparator + "\Notes.txt");
//System.out.println(readNotes.get(0));

if (!"File not found".equals(readNotes.get(0)))
allNotes.clear();
for (String str : readNotes)
String[] tmp = str.split("t");
System.out.println(str);

Note n = new Note();
n.setNoteID(Integer.parseInt(tmp[0]));
n.setCourse(tmp[1]);
n.setDayte(tmp[2]);
n.setNote(tmp[3]);

allNotes.add(n);

/*int nid = Integer.parseInt(tmp[0]);
Note n = new Note(nid, tmp[1], tmp[2], tmp[3]);
allNotes.add(n);

if (nid > maxID)
maxID = nid;
*/



maxID++;


public void addNote(int maxID, String course, String note)
Note myNote = new Note(maxID, course, note);
allNotes.add(myNote);
writeAllNotes();


public ArrayList<Note> getAllNotes()
return allNotes;


private void writeAllNotes()
String path = appDir + fileSeparator + "\Notes.txt";
ArrayList<String> writeNote = new ArrayList<>();

allNotes.stream().map((n) ->
String tmp = n.getNoteID() + "t";
tmp += n.getCourse() + "t";
tmp += n.getDayte() + "t";
tmp += n.getNote();
return tmp;
).forEachOrdered((tmp) ->
writeNote.add(tmp);
);
try
//FileWriter writer = new FileWriter("path");
//BufferedWriter bw = new BufferedWriter(writer);
writeTextFile(path, writeNote);
catch (IOException e)
System.out.println("Problem! " + path);



public String searchAllNotesByKeyword(String noteList, int i, String s)
if (i == allNotes.size())
return noteList;


if (allNotes.get(i).getNote().contains(s))
noteList += allNotes.get(i).getNote() + "n";


return searchAllNotesByKeyword(noteList, i + 1, s);









java file file-io text-files






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 2:07









Andrew Thompson

154k29166352




154k29166352










asked Mar 22 at 17:30









justcainjustcain

1




1












  • Never mind. Fixed the code

    – justcain
    Mar 22 at 17:49











  • "Never mind. Fixed the code" Please either enter the solution below, or delete the question. As it stands, this Q(&A) brings no value to future visitors. BTW - you mention a GUI. If Swing, look at JTextComponent.write(Writer).

    – Andrew Thompson
    Mar 23 at 2:07


















  • Never mind. Fixed the code

    – justcain
    Mar 22 at 17:49











  • "Never mind. Fixed the code" Please either enter the solution below, or delete the question. As it stands, this Q(&A) brings no value to future visitors. BTW - you mention a GUI. If Swing, look at JTextComponent.write(Writer).

    – Andrew Thompson
    Mar 23 at 2:07

















Never mind. Fixed the code

– justcain
Mar 22 at 17:49





Never mind. Fixed the code

– justcain
Mar 22 at 17:49













"Never mind. Fixed the code" Please either enter the solution below, or delete the question. As it stands, this Q(&A) brings no value to future visitors. BTW - you mention a GUI. If Swing, look at JTextComponent.write(Writer).

– Andrew Thompson
Mar 23 at 2:07






"Never mind. Fixed the code" Please either enter the solution below, or delete the question. As it stands, this Q(&A) brings no value to future visitors. BTW - you mention a GUI. If Swing, look at JTextComponent.write(Writer).

– Andrew Thompson
Mar 23 at 2:07













0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55304955%2fgui-application-for-writing-notes%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55304955%2fgui-application-for-writing-notes%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해