1

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.

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Rikimaru
  • 25
  • 3
  • 2
    http://docs.oracle.com/javase/tutorial/uiswing/. Note that JFrame and JLabel are Swing components, and not AWT components. – JB Nizet Nov 25 '12 at 16:48
  • @JBNizet `JComponent extends Component` – John Dvorak Nov 25 '12 at 16:50
  • @JBNizet so Swing components technically _are_ AWT components. – John Dvorak Nov 25 '12 at 16:58
  • 1
    Except you're not supposed to use Swing components in AWT applications, and vice-versa. Swing components happen to inherit from AWT component, but as you said, it's only a technical relationship. You're nitpicking: What we call AWT components are heavyweight components in the AWT package. What we call Swing components are lightweight component in the swing package. – JB Nizet Nov 25 '12 at 17:03
  • @Jan Dvorak both Trabant and Porsche are cars, isn't it, sure Swing is based on, inherits and nesting of methods came from AWT – mKorbel Nov 25 '12 at 17:03
  • 1
    See if [this answer](http://stackoverflow.com/a/11769153/230513) helps. – trashgod Nov 25 '12 at 20:56

1 Answers1

0

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

vels4j
  • 11,208
  • 5
  • 38
  • 63