Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Create an Uber Clone in 7 Days: Build a real world full stack mobile app in Java this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

swing  RSS feed

 
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!....
 
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.
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!