• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What is a Java Peer Object?

 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is a peer object?
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java visual components are just pictures on a GUI. They do not actually have any functionality as far as the operating system is concerned.
In the AWT when you create a button the JVM "hooks" your button up to what the operating system thinks of as a "REAL" button. That is the OS peer.
In the original AWT all of the components were "heavyweight" components, meaning that they were tightly associated with the underlying peer component. This caused the "look and feel" of the components to be highly influenced by what the operating system defined that component to look like. That means that a button in Windows had a different look and feel from a Motif button on a Unix machine.
When Swing came along there was a lot of effort put into having the Java Components actually DO the work and therefore be less dependant on their underlying peer component. These components are considered to be "light-weight" because they are not so strongly influenced by the OS. This allows the look and feel of Swing component to be more consistant from platform to platform.
It is NOT a good idea to mix lightweight and heavyweight components - because the heavyweight ones will often trash the lightweight ones.
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the very clear explanation.
 
Slime does not pay. Always keep your tiny ad dry.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic