Search code examples
javaswingjframejlabelcontentpane

issue about Concept of JFrame, JLabel and ContentPane


I just study window programming with awt.

I see through several codes but I can not get concepts of JFrame, JLabel and ContentPane.

I think JFrame only make outer Frame. ContentPane is container that contain JLabel that has contents(text, button, radio etc...).

I don't know this is correct T.T

Why I ask this is I failed combine the contents. I can not make TextField and InternalFrame at a time.

I want to know the concept. I hope you take my question right.


Solution

  • You need to get clean view for AWT vs Swing. Here is a good explanation for Swing or AWT: Which is right for you?

    JFame :
    An extended version of java.awt.Frame that adds support for the JFC/Swing component architecture. See How to Make Frames

    JLabel :
    Display component for your short text like Name : , Phone Number : etc., See How to Use Labels

    Container :
    Container is a component that holds or wraps-up other components. It aids with grouping related components together in the GUI. Document of Swing Containers