The problem people have in trying to create something foolproof is that they generally underestimate the inginuity of fools.
it's got to be possible to create a flexible amount of buttons in a content pane depending on how many items are in my list, right?
The problem people have in trying to create something foolproof is that they generally underestimate the inginuity of fools.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
The problem people have in trying to create something foolproof is that they generally underestimate the inginuity of fools.
Originally posted by Martin Vietor:
I hope so, like I said - I may be missing some basic understanding here. I've only been using java for a week, a lot of the terms are a bit sketchy. And in a foreign language. So bear with me, if I use simple-sounding terms.
But basically static methods belong to the class and only exist once, while "this" refers to an object (like a button) that can exist in multiple copies.
Which does explain why it doesn't work the way I got it set up right now. If I write a method createButton that is (obviously) not static, I can't "hand over" (<- simlpe sounding term) my variable plant to that method as I would in a static (createButton(plant)). Which means I will reproduce EXACTLY the same button, but mine are supposed to differ, depending on the values in plant. I'll get the same problem later on, when actionPerformed is supposed to open a frame with plant.name as title bar.
This probably isn't even a real problem, I just don't know enough code yet. Frustrating to learn a new language, isn't it.
M
Originally posted by Martin Vietor:
If I write a method createButton that is (obviously) not static, I can't "hand over" (<- simlpe sounding term) my variable plant to that method as I would in a static (createButton(plant)). Which means I will reproduce EXACTLY the same button, but mine are supposed to differ, depending on the values in plant.
M
The problem people have in trying to create something foolproof is that they generally underestimate the inginuity of fools.