This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Why copy? You can read a .java file just as easily as a .txt.
I would hazard a guess that what the assignment's really looking for is your ability to locate and access a file based on the running class's name and package structure. Always assuming that the .class and .java are located in the same folder, under the package root (if there's a package statement).
Also note that you don't
Create an applet that loads its own source code in a JFrame.
You display the contents of a text file (yes, a .java file is a text file) in an appropriate JTextComponent which is shown in a JFrame.
I don't see why an Applet should come into the mix, unless part of the test is to launch a JFrame from an Applet.
There are no new questions, but there may be new answers.
Joined: Apr 27, 2012
Thanks for the advice on readi.g .java files. And the use of an applet is just to get familiar with creating and implementing them.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Loading Source Code into a JFrame in an Applet