Re: Problem in reloading a JFrame
"Rohit Gupta" <rg.iitk@gmail.com> wrote in message
news:1148291381.164115.202880@i39g2000cwa.googlegroups.com...
Ok, finally I have made the SSCCE, you can try it now and tell me what
is the problem...
What I am doing in this piece of code is that I am displaying initially
a button with text "start", on pressing the reload button the text
should alternately change from "dony" and "pony", try maximizing the
applet to see the problem.
Can anyone tell me now what to do.
[code snipped]
There's a lot of problems with this code.
* First of all, you have to decide whether you are trying to write an
application, or an applet.
* Second, you should decide whether you want to use Swing or AWT.
* You should also collect all your GUI creation code into one method,
instead of having half of it in displayFrame() and the other half in
displayResults(). This GUI construction code shouldn't be made publicly
accessible. Instead, call it within the constructor of the class managing
the window.
* The add(String, Component) method you're using has been obsolete since
Java 1.1. We're now at Java 1.5, with 1.6 coming out soon. Use the
add(Component, Object) method instead.
* You say you want to change the text of the button, but your
refreshResults() method doesn't ever even refer to the button.
- Oliver