Content deleted Content added
No edit summary Tags: Reverted possible conflict of interest |
m (GR) File renamed: File:RunningApplication.png → File:Java Swing GridBagLayout example.png Criterion 2 (meaningless or ambiguous name) Tag: Reverted |
||
Line 212:
The layout is set to null using the {{Javadoc:SE|member=setLayout(LayoutManager)|java/awt|Container|setLayout(java.awt.LayoutManager)|module=java.desktop}} method since JFrame uses java.awt.BorderLayout as its default layout-manager. With BorderLayout anything which is added to the container is placed in the center and stretched to accommodate any other widgets. Of course, most real world GUI applications would prefer to use a layout-manager instead of placing everything on absolute co-ordinates.<ref>{{cite book|last1=Eckel|first1=Bruce|title=Thinking in Java|date=2006|publisher=Prentice Hall|isbn=978-0131872486|page=942|edition=4|url=http://www.agentgroup.unimore.it/~nicola/courses/IngegneriaDelSoftware/java/books/ThinkingInJava.pdf|access-date=13 May 2016|url-status=dead|archive-url=https://web.archive.org/web/20160514000820/http://www.agentgroup.unimore.it/~nicola/courses/IngegneriaDelSoftware/java/books/ThinkingInJava.pdf|archive-date=14 May 2016}}</ref>
===A GridBagLayout example using the Packer subclass of the GridBagLayout Manager===
[[File:
The GridBagLayout class provides a rectangular layout mechanism which is specified using instances of the GridBagConstraints class. This mechanism is very tedious in code because of all the individual lines of code needed to specify the attributes in the GridBagConstraints instances, and the fact that the constraints are not reusable due to each instance used being referenced continuously at runtime. The Packer and PackAs class and interface available at https://github.com/greggwon/Packer, provide a repackaging of the power of this layout manager into a different API. The instances of GridBagConstraints are managed behind the scenes and this makes it much easier to create layouts of components.
|