• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

AWT - Summary

Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All :
Today I was reading AWT and noted few important things.
Let me know if there are any incorrect points.
If you have any other points please append().
1. When a frame is constructed, it has no size and is not displayed on the screen. To give a frame a size, call one of the inherited methods setSize() or setBounds(). Once a frame has been given a size, you can display it by calling setVisible(true).
2. Each component has a set of defaults for background and foreground colors and for the font to be used. If you don't see these, the default values of the container this component is in will be used when the font or color is required. If you don't specify any appearance factors, the JVM will provide defaults.
1. Flow layout is the default layout for Panel and Applet.
1. Border layout is the default layout for Frame and Dialog.
2. North and South portion honors the preferred height. East and West portion honors the preferred width. The center portion takes the remaining.
1. Always ignores a component´┐Żs preferred size.
2. Implements the LayoutManager interface to lay out Component objects in a Container.
3. Divides the Container into a specified number of rows and columns and arranges the components in those rows and columns, left-to-right and top-to-bottom
4. Components added to a GridLayout have no control over their positioning.
5. new GridLayout(0,0) gives compilation error
1. fill : Tells the GridBagLayout what to do when a component is smaller than its display area. The default value, GridBagConstraint.NONE, causes the component size to remain unchanged.
2. weightx and weighty : Can have any values between Double.MIN_VALUE and Double.MAX_VALUE. But typical value are between 0.0 and 1.0.
3. If you specify the fill field is BOTH, there is no meaning to set anchor field
1. A component may have multiple listeners for any event type. There is no guarantee that listeners will be notified in the order in which they were added. There is also no guarantee that all listener notification will occur in the same thread.
2. A component can handle events by overriding its event dispatching method. However, you will have to invoke its enableEvents() method, passing the event identifier.
3. If a selected menu - item does not have action events enabled but it parent does, the action event is passes up to the menu.
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The summarization is good.
Just a correction. Point #5 under GridLayout. It does not produce compile error but produes an IllegalArgumentException (RunTimeException).
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more point in Frames..
We can use pack() to set the size. This causes the Window to be sized to fit the preferred size and layouts of its subcomponents
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic