Home > Blockchain >  Differences between containers
Differences between containers

Time:10-23

I have read many different topics and information sources but I can't really understand the differences of containers in java I know JPanel, JFrame and Container are similar and should be used at different levels within the construction of a program and I know there is JWindow and acts relatively the same. I am fairly new to programming so I am just unfamiliar with the setup. Here is what I have found out/assumed about each one, please correct me if i'm wrong.

JPanel is for the integration between JFrame or a Container typically separating different sections for labels, buttons, sliders etc...

JFrame acts as a receiver of JPanels and can construct them based on instructions from the coder, JFrame can also take the same labels, buttons, sliders etc....

Container is the same as JFrame though I am assuming container is a parent of JFrame.

I'm unsure of JWindow I just found out about this one.

CodePudding user response:

Both JPanel and JFrame are Containers, yet more specialized for specific purposes. And yes, you have to assemble them correctly so they act as your user interface.

But as Container does not do much on it's own you probably never put that into your UI directly. Use it as base class to construct more specialized other classes.

To move along get some simple example running, you could follow the Java Tutorials.

  • Related