Campbell Ritchie wrote:Welcome to the Ranch
Why do you want to update the state of that text field? Why do you need to do it from the utils class (which should start * not *)? Why are you returning a panel? Why do you appear to be setting up the GUI is a method not specifically designed for setting up GUIs? I think you need to explain what you want to do, before anybody can work out how to do it.
Campbell Ritchie wrote:I am afraid that doesn't explain anything new. I already presumed you wanted to update the text.
Fred Kleinschmidt wrote:First of all, you need to re-design the ServiceMonitor class. The getLegend method should not be static, and it probably should not be public. The GUI items (especially "green" should be private instance variables, and then you call getLegend() from the constructor to create the GUI. You also create a public method setGreenText(). So if your Util class has a reference to a ServiceMonitor instance, it can call
Campbell Ritchie wrote:Unless you need specific graphics to appear on the panel, you can probably do it without extending any Component classes at all.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |