Hello MCM,
I am currently learning Java and so to practice I decided to make a notepad.
I have come across a few problems, which I cannot figure out how to solve;
Problem #1
Your file is saved to a .txt, so next time you open it, it will be in a notepad, instead of the application, I would like to fix this. I want it so that you double click the file and it automatically opens the Java notepad.
Code:
Problem #2
Upon clicking "New", it asks you if you're sure that you want to clear the text area. If you click yes, it sets the text to "". However, if you click no, it does the same thing, even though I tried to make a string (String x = t.getText(), t.setText(x)). It didn't work. How can I make it so that clicking "No" will simply close the JOptionPane and keep the text?
Code:
Problem #3
The margin will not work on the JTextArea.
Code: t.setMargin( new Insets(10,10,10,10) );
Problem #4
The last problem is that when you "Open" (via the JMenu) the .txt, the lines (/n) are not saved, e.g. all the text is printed out onto one line. How do I fix this? I could not ask this question to google as it is quite specific and I did not know how to word it.
If these questions are "stupid" then bare in mind, I am still learning. I have already looked at StackOverflow but to no avail.
If any of you want to add my skype it is Mixtape.Archie, if you want to teach me Bukkit API / give me links to helpful sources then please do!
Thank you very much,
Archie.
I am currently learning Java and so to practice I decided to make a notepad.
I have come across a few problems, which I cannot figure out how to solve;
Problem #1
Your file is saved to a .txt, so next time you open it, it will be in a notepad, instead of the application, I would like to fix this. I want it so that you double click the file and it automatically opens the Java notepad.
Code:
Problem #2
Upon clicking "New", it asks you if you're sure that you want to clear the text area. If you click yes, it sets the text to "". However, if you click no, it does the same thing, even though I tried to make a string (String x = t.getText(), t.setText(x)). It didn't work. How can I make it so that clicking "No" will simply close the JOptionPane and keep the text?
Code:
Problem #3
The margin will not work on the JTextArea.
Code: t.setMargin( new Insets(10,10,10,10) );
Problem #4
The last problem is that when you "Open" (via the JMenu) the .txt, the lines (/n) are not saved, e.g. all the text is printed out onto one line. How do I fix this? I could not ask this question to google as it is quite specific and I did not know how to word it.
If these questions are "stupid" then bare in mind, I am still learning. I have already looked at StackOverflow but to no avail.
If any of you want to add my skype it is Mixtape.Archie, if you want to teach me Bukkit API / give me links to helpful sources then please do!
Thank you very much,
Archie.
Banned forever. Reason: Scamming (https://builtbybit.com/threads/archie-scam-report.114655/)
