• (4 Pages)
  • +
  • « First
  • 2
  • 3
  • 4

Creating a basic Notepad Application Rate Topic: ***** 7 Votes

#46 xinaodan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 09-November 14

Posted 09 November 2014 - 08:43 AM

Thanks, it's really useful for me~
Was This Post Helpful? 0
  • +
  • -

#47 DevCodeks  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 15-September 14

Posted 09 November 2014 - 12:55 PM

View Postran123, on 02 December 2008 - 11:16 AM, said:

How do I run this notepad program. I tried adding the main method and then creating an instance of it, but nothing happened.

You can run this with cmd (Command Prompt), save the code of "Notepad" in on folder and after this go with cmd in the folder when is the code of notepad, and in cmd press javac name of the code.java (example: javac notepad.java)
Was This Post Helpful? 0
  • +
  • -

#48 pcr3w  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 25-November 14

Posted 26 November 2014 - 09:08 AM

Thank you for this, I stumbled across it a few months ago but didn't have an account. It's been very helpful!

~ Pcr3w
Was This Post Helpful? 0
  • +
  • -

#49 ghozt2015  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 34
  • Joined: 19-July 15

Posted 22 July 2015 - 01:16 AM

I just finished writing all this code from top to bottom and it is 4 o clock am where I am lol. I did not intend on finishing it but I started and did not stop until the job was done. I still have yet to get it correctly though. I am sure I made a lot of errors, there are red highlights all over Netbeans editor window lol. I will come back tomotrow and work on debugging and whatnot, but I really did enjoy following step by step and writing out the code. Just some advice for others....avoid auto-filling when it comes to writing code. No matter how bad you want to just hit enter when the auto fill option pops up just keep typing away. This will help your muscle memory and will drill this stuff into your brain.
Was This Post Helpful? 0
  • +
  • -

#50 yankzlaw  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 24-August 15

Posted 24 August 2015 - 06:24 PM

Good Day Sir

how to program, that will save output in notepad..or display output in notepad text file
Was This Post Helpful? 0
  • +
  • -

#51 shazbotfoolio  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 24-October 15

Posted 25 October 2015 - 11:29 PM

I found something about this code that doesn't function as it should - it is failing to clear the entire text area, when using the Open file menu option, under certain conditions, which I will attempt to explain.

Let's say you have run the Java Notepad Tutorial application some time in the past and have created and saved a file with several lines of text.
Let's say you open the Java Notepad Tutorial and type in only a few letters of text, and then attempt to open the other file that had been previously saved with the application. What will happen is, the contents of the file to be opened are appended to the end of the few letters that are already written, instead of the intended behavior of clearing the entire text screen, before applying the text of the file to be opened.

Initially while testing, the problem seemed only to happen when the first file has at most one line of text in it, before attempting to open another file. It also seems to happen "back and forth," by which I mean the first time you try opening a file, it will append instead of totally erasing first, and then if you try it a second time, it will clear the text area as intended and display only the contents of the opened file. If, however, you try it a third time, then it will append again.

After some more testing i discovered the program won't always replicate the problem if the single line of text is long enough, so i thought at that point it might only happen when attempting to open another file when you've only got a very few letters typed in - if the short single line of text you start with has been *saved as a file*, though, then it does seem to replicate the problem with the "back and forth" behavior as i described.
After more testing with these longer single line unsaved initial files, they do seem to replicate the problem when the second file opened has no breaks in it, but not when breaks do exist in the second file...

After even more testing, i discovered that the application will append instead of erasing even when the initial file is longer than one line, provided there are no breaks (no pressing enter for a new line).
For example a file consisting of four lines of nothing but letter O's, never having pressed enter, will replicate the problem. But, a file consisting of four o's, an enter, and four o's on the second line, will never replicate the problem. I suspect the problem has something to do with the \n new line character..?

I am very curious what the reason is for this error, and if it is somehow, for some reason, only happening for me. I'd like somebody else to attempt to replicate the problem, so someone can at least share in my confusion, if nothing else. I wonder how much testing was even done on this, since it seems (from my perspective) like any small amount of testing would produce this error, but I don't see that anyone else has mentioned anything like it in the comments. I wondered as well if it could be some change in how the code functions, due to updates in java itself over the years, since this tutorial was written in 2008. I'm currently using Java Version 8 Update 60, and have imported and run the program in Eclipse Version: Luna Release (4.4.0).

Another curiosity is about the resource leak warning about the unclosed Scanner scan in line 79 of the "Final Product!"
After some testing with closing the scan resource, i don't think it is related to the problem with not clearing the text area, but it is still something I'd like to know about. Attempting to close the resource in a "finally" block (as some places I've researched suggest to do) after the try/catch block, did not seem to close it correctly. I tried closing it right there in the try block, after the while loop, hoping it wouldn't cause other problems.. and it didn't seem to - the program was still functional, but still had the not-clearing the text area problem.
Was This Post Helpful? 0
  • +
  • -

#52 CalPang  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 9
  • Joined: 13-March 16

Posted 14 March 2016 - 03:40 AM

Very nice tutorial, I did this after the simple chat application but I think this is an easier tutorial for beginner to start with.

Great post!
Was This Post Helpful? 0
  • +
  • -

  • (4 Pages)
  • +
  • « First
  • 2
  • 3
  • 4