com.moneydance.awt
Interface PackAs

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
Packer

public interface PackAs
extends java.io.Serializable

This interface is returned/used by the Packer layout manager. The methods are used to arrange the layout of components. The majority of these methods correspond directly to elements of the GridBagConstraints object and its use with the GridBagLayout layout manager. The purpose of this class is to make the use of these two objects simpler and less error prone by allowing the complete layout of an object to be specified in a single line of code, and to discourage the reuse of GridBagConstraint Objects which leads to subtle layout interactions.

Pay attention to the fact that fillx(), filly() and fillboth() change the weights of the respective axis. This is done to unify the expansion factors to equally distribute the components if you do not specify weight[xy] values. If you do not specify the weight[xy] values, they default to 1. Thus, you must always put the weight[xy]() after the fill[xy]() if you want something different than equal expansion.

When putting several buttons into a JPanel, you can use ...fillx().weightx(0) to make all of them the same width, but keep the JPanel from being any wider than the widest button.

Version:
3.0
Author:
Gregg Wonderly
See Also:
org.wonderly.awt.Packer

Method Summary
 PackAs add(java.awt.Component c)
          Reuses the previous set of constraints to layout the passed Component.
 PackAs bottom()
          Add gridy=REMAINDER to the constraints for the current component.
 PackAs east()
          Add anchor=EAST to the constraints for the current component.
 PackAs fillboth()
          Add fill=BOTH,weighty=1,weightx=1 to the constraints for the current component.
 PackAs fillx()
          Add fill=HORIZONTAL,weightx=1 to the constraints for the current component.
 PackAs filly()
          Add fill=VERTICAL,weighty=1 to the constraints for the current component.
 PackAs gridh(int cnt)
          Add gridheight=tot to the constraints for the current component.
 PackAs gridw(int cnt)
          Add gridwidth=tot to the constraints for the current component.
 PackAs gridx(int pos)
          Add gridx=tot to the constraints for the current component.
 PackAs gridy(int pos)
          Add gridy=tot to the constraints for the current component.
 PackAs inset(java.awt.Insets insets)
          Specifies the insets to apply to the component.
 PackAs inset(int top, int left, int bottom, int right)
          Specifies the insets to apply to the component.
 PackAs into(java.awt.Container cont)
          Set the passed container as the container to pack future components into.
 PackAs left()
          Add gridx=RELATIVE to the constraints for the current component.
 PackAs north()
          Add anchor=NORTH to the constraints for the current component.
 PackAs northeast()
          Add anchor=NORTHEAST to the constraints for the current component.
 PackAs northwest()
          Add anchor=NORTHWEST to the constraints for the current component.
 PackAs pack(java.awt.Component c)
          Creates a new set of constraints to layout the passed Component.
 PackAs padx(int cnt)
          Add ipadx=cnt to the constraints for the current component.
 PackAs pady(int cnt)
          Add ipady=cnt to the constraints for the current component.
 PackAs remainx()
          Add gridwidth=REMAINDER to the constraints for the current component.
 PackAs remainy()
          Add gridheight=REMAINDER to the constraints for the current component.
 PackAs right()
          Add gridx=REMAINDER to the constraints for the current component.
 PackAs south()
          Add anchor=SOUTH to the constraints for the current component.
 PackAs southeast()
          Add anchor=SOUTHEAST to the constraints for the current component.
 PackAs southwest()
          Add anchor=SOUTHWEST to the constraints for the current component.
 PackAs top()
          Add gridy=RELATIVE to the constraints for the current component.
 PackAs weightx(double wt)
          Add weightx=wt to the constraints for the current component.
 PackAs weighty(double wt)
          Add weighty=wt to the constraints for the current component.
 PackAs west()
          Add anchor=WEST to the constraints for the current component.
 

Method Detail

into

PackAs into(java.awt.Container cont)
            throws java.lang.IllegalAccessException
Set the passed container as the container to pack future components into.

Throws:
java.lang.IllegalAccessException - when the container is already set and cloning the Packer instance fails.

inset

PackAs inset(java.awt.Insets insets)
Specifies the insets to apply to the component.

Parameters:
insets - the insets to apply

inset

PackAs inset(int top,
             int left,
             int bottom,
             int right)
Specifies the insets to apply to the component.

Parameters:
left - the left side inset.
top - the top inset.
right - the right side inset.
bottom - the bottom inset.

north

PackAs north()
Add anchor=NORTH to the constraints for the current component.


south

PackAs south()
Add anchor=SOUTH to the constraints for the current component.


east

PackAs east()
Add anchor=EAST to the constraints for the current component.


west

PackAs west()
Add anchor=WEST to the constraints for the current component.


northwest

PackAs northwest()
Add anchor=NORTHWEST to the constraints for the current component.


southwest

PackAs southwest()
Add anchor=SOUTHWEST to the constraints for the current component.


northeast

PackAs northeast()
Add anchor=NORTHEAST to the constraints for the current component.


southeast

PackAs southeast()
Add anchor=SOUTHEAST to the constraints for the current component.


left

PackAs left()
Add gridx=RELATIVE to the constraints for the current component.


top

PackAs top()
Add gridy=RELATIVE to the constraints for the current component.


right

PackAs right()
Add gridx=REMAINDER to the constraints for the current component.


bottom

PackAs bottom()
Add gridy=REMAINDER to the constraints for the current component.


gridx

PackAs gridx(int pos)
Add gridx=tot to the constraints for the current component.

Parameters:
pos - - the value to set gridx to.

gridy

PackAs gridy(int pos)
Add gridy=tot to the constraints for the current component.

Parameters:
pos - - the value to set gridy to.

gridh

PackAs gridh(int cnt)
Add gridheight=tot to the constraints for the current component.

Parameters:
cnt - - the value to set gridheight to.

gridw

PackAs gridw(int cnt)
Add gridwidth=tot to the constraints for the current component.

Parameters:
cnt - - the value to set gridwidth to.

padx

PackAs padx(int cnt)
Add ipadx=cnt to the constraints for the current component.

Parameters:
cnt - - the value to set ipadx to.

pady

PackAs pady(int cnt)
Add ipady=cnt to the constraints for the current component.

Parameters:
cnt - - the value to set ipady to.

fillx

PackAs fillx()
Add fill=HORIZONTAL,weightx=1 to the constraints for the current component.


filly

PackAs filly()
Add fill=VERTICAL,weighty=1 to the constraints for the current component.


fillboth

PackAs fillboth()
Add fill=BOTH,weighty=1,weightx=1 to the constraints for the current component.


weightx

PackAs weightx(double wt)
Add weightx=wt to the constraints for the current component.

Parameters:
wt - - the value to set weightx to.

weighty

PackAs weighty(double wt)
Add weighty=wt to the constraints for the current component.

Parameters:
wt - - the value to set weightx to.

add

PackAs add(java.awt.Component c)
Reuses the previous set of constraints to layout the passed Component.

Parameters:
c - The component to layout.

pack

PackAs pack(java.awt.Component c)
Creates a new set of constraints to layout the passed Component.

Parameters:
c - The component to layout.

remainx

PackAs remainx()
Add gridwidth=REMAINDER to the constraints for the current component.


remainy

PackAs remainy()
Add gridheight=REMAINDER to the constraints for the current component.