Re: Creating a component by putting together others

CK escribió:
But I'm not sure how to do that. I've thought of putting both
components (JTextField and JButton) inside a JPanel, and thus I would
write my custom component by extending a JPanel with two private
properties holding the text field and the button. Would that be
sensible or should I extend JComponent (which I think is more complex)?

Your custom component does not offer funtionality on its own, right?

Just the coupling between the text field and the button, so if you
press the button, a select file dialog appears. If you select a file
there, on closing the select file dialog, the pathname is
automatically copied in the text field.

So, it probably doesn't.

So it isnt really a component but more like a wrapper pane(l).

I would subclass JPanel, since what your component tries to do has
more to do with a JPanel than any other JComponent.

OK, thank you very much for your promptly response.

Computers are stupid, but they create work

(...just like some users...) ;-)

If it's true that we are here to help others,
then what exactly are the OTHERS here for?