When making a GUI, does it matter whether you use 'content' or 'this'?

For Example:

content.add(b1);

OR

this.add(b1);

Recommended Answers

All 2 Replies

Yes.
'this' refers to the current object - whatever that object is. It could be anything.
'content' refers to whatever you defined it as. Most likely it's a Container ref obtained from getContentPane() somewhere in your program.

Yes.
'this' refers to the current object - whatever that object is. It could be anything.
'content' refers to whatever you defined it as. Most likely it's a Container ref obtained from getContentPane() somewhere in your program.

Thanks a lot, that has cleared things up

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.