Angus Ferguson wrote:
It can get much more elaborated and it offers the posibility to reduce duplicated code improving readibility, scalability and modularity.
Angus Ferguson wrote:Using RETURN is useful when you want to retrieve and use the output of the method which is returning the value in a wider scope. For example, if you write a method calculateSum() and it returns the value 5 you could use that value 5 together with another methods like multiply() in order to orchestrate them and solve a bigger problem.
Campbell Ritchie wrote:TextArea1 is a bad name for a class; it doesn't constitute a text area, but uses a text area, which is different. I might have called it TextAreaDemo. Or I might have called it something different.
You are indenting your code incorrectly: look at lines 26‑31. I think they should be formatted like this, if you want to keep the lines very short:-But that won't correct your compile‑time error. One line has s and the other has S; one of them will be wrong and that will cause a different compile‑time error. S is probably correct.
public class TextArea1 implements
Rob Camick wrote:No that code is still wrong.
Campbell Ritchie wrote:If you don't add the panel to the frame or make the frame appear, nothing will happen.[/tt]
Carey Brown wrote:You need a JFrame object to hold all your Swing objects, including you MyDrawPanel. You don't need to create a JPanel, that comes with Swing. The class that either extends JFrame or instantiates a JFrame must include a main() method.
It's best to post a simple self contained compilable program here on this website (even if it's not working as desired), this will help you get the most responses.