When building applications with swing, is it considered bad to make the components class variables? It's difficult to access them otherwise without making it very difficult to add more components. I'd like to make my JTextAreas private class variables, but is that "bad" coding?
It's perfectly fine to ise member variables to hold references to components; in fact, there isn't realy any alternative. But you said class variables, or "static" variables in Java. This is not especially good style; it leads to code like this:
This is bad because it's procedural, because it makes the code hard to reuse, because it leads to very long, hard to modify methods, etc.
There's an easy alternative, and it looks like this: