Results 1 to 2 of 2
  1. #1
    baltimore is offline Member
    Join Date
    Jul 2007
    Rep Power

    Default differences: AWT and Swing

    Hello, I am trying to find out the difference between AWT and Swing.
    I read somewhere that the Swing components are implemented with absolutely no native code.
    I could not understand the meaning of "native code".Can somebody explain its meaning?


  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Rep Power


    Native widgets are called peers. A java AWT component needs a peer to be shown on the screen. Lightweight, Swing (J prefix) components do not. However they must be shown in a top–level container (JApplet, JFrame, JWindow, etc) which does need a peer or native widget.
    The AWT is the original abstract windowing tookit. The Swing set came out in j2se 1.2
    You can find a lot of AWT code on the web, old applets and the like. Also, I think the mobile phone people use AWT. Swing is easier to use, has more options and is most common in use by developers. It is best not to mix the two. You can but there are some gotchas to be aware of.

Similar Threads

  1. differences between bytecode and executable code
    By valery in forum New To Java
    Replies: 2
    Last Post: 04-16-2009, 09:13 AM
  2. Differences between constructor and method
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-19-2007, 09:53 AM
  3. AWT or Swing
    By bugger in forum AWT / Swing
    Replies: 4
    Last Post: 11-22-2007, 10:44 AM
  4. differences between 2 dates
    By cecily in forum New To Java
    Replies: 1
    Last Post: 08-02-2007, 06:37 PM
  5. map javax.swing.text.Element to javax.swing.text.View
    By elizabeth in forum New To Java
    Replies: 1
    Last Post: 07-30-2007, 08:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts