728x90 AdSpace

Trending

difference between a Frame and a JFrame


The first difference most of us identify is that, there is  J in JFrame but not in Frame :p
 Obviously if both represent the same, then they wont have different names:-

A JFrame is an extended version of a Frame, you will probably find a JFrame to be a little easier to use as some of the complexities of using a Frame are done for you.
Main differences are:-
Frame
JFrame


  • Frame is part of java.awt package.it is legacy version of java.
  • Frame extends window
  • Frame does not implements javax.swing.RootPane Container and javax.accessibility.Accessible interface
  • JFrame is part of javax.swing package and it is availble from 1.1 version onwards.
  • JFrame extends Frame
  • JFrame implements javax.swing.RootPane Container and javax.accessibility.Accessible interface, frame does not.
  • JFrame directly supports javax.swing.JMenuBar
  • we can add component directly to the JFrame and so there is no need to container class.

AWT

AWT stands for Abstract Window Toolkit .It provides Graphical user interface.AWT provides the connections between your application and the native GUI.The AWT graphics functions are provided with the operating system has a graphical one to one relationship between the function, we call it peers. The Abstract Window Toolkit provides the connection between your application and the native GUI.Because different operating system's graphics library functions provided are not the same, there is a function of the platform on another platform may not exist.Since AWT is to rely on local methods to achieve its function, we usually called heavyweight AWT controls control.

SWING

Swing AWT is built on the basis of a new Graphical Interface system.Swing implements a set of GUI components that build on AWT technology and provide a pluggable look and feel. Swing is implemented entirely in the Java programming language, and is based on the JDK 1.1 Lightweight UI Framework.Swing components do not depend on peers to handle their functionality. Thus, these components are often called "lightweight" components.


AWT
SWING


  • usage of native peers speeds component performance.
  • .most Web browsers support AWT classes so AWT applets can run without the Java plugin.
  • : AWT components do not support features like icons and tool-tips.
  • AWT components more closely reflect the look and feel of the OS they run on.
  • use of native peers creates platform specific limitations.
  • Most Web browsers do not include the Swing classes, so the Java plugin must be used
  • Some components may not function at all on some platforms.
  • Swing supports a wider range of features like icons and pop-up tool-tips for components.
  • Even when Swing components are set to use the look and feel of the OS they are run on, they may not look like their native counterparts.

Dont mix heavywight components with lightwight components.They may leads to unexpected results.

difference between a Frame and a JFrame Reviewed by B AProgrammer on 11:48 Rating: 5 The first difference most of us identify is that, there is  J in JFrame but not in Frame :p  ...