• Post Reply Bookmark Topic Watch Topic
  • New Topic

swing  RSS feed

 
Ariffin Ahmad
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm confuse.....
when i want to create a swing app, i have a choice from few choices...
i have, JPanel, JFrame, JWindow etc...
what is the different between all this...
when i tried all, it seem, all the same....
help!....
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ariffin,
Maybe from a programming standpoint they are the same but visually they are VERY different!
JPanel is a generic container for any components. It has no decorations and is not controlled by the Windowing environment.
An Applet is a subclass of JPanel, therefore it is the same thing with some extensions to work with browsers.
JWindow is a container that is controlled by the Windowing environment but has no decorations (title bars, resize handles, system buttons, etc).
JFrame is a container that is controlled by the Windowing environment and has all required decorations to look like a system window. This is usually the choice for java applications that require windows.
JDialog is a container that is controlled by the Windowing environemnt and some required decorations to look like a system window. JDialogs are handy for input and can be made modal (blocks until dismissed).
Each choice has its own pros and cons. Since you are just starting use JFrame for an application and JApplet for an applet. Leave the others for more advanced stages of your programming career.
Regards,
Manfred.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!