net.mariottini.layout
Class SimplePileLayout

java.lang.Object
  extended by net.mariottini.layout.SimplePileLayout
All Implemented Interfaces:
LayoutManager

public final class SimplePileLayout
extends Object
implements LayoutManager

A layout manager that piles components either vertically or horizontally. Components are layed out with their preferred with and height. This is a semplified version of PileLayout. See the document "How to use PileLayout" for more information.

License:
  Copyright © 2006, 2007 Roberto Mariottini. All rights reserved.

  Permission is granted to anyone to use this software in source and binary forms
  for any purpose, with or without modification, including commercial applications,
  and to alter it and redistribute it freely, provided that the following conditions
  are met:

  o  Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.
  o  The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  o  Altered source versions must be plainly marked as such, and must not
     be misrepresented as being the original software.
 
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  SUCH DAMAGE.
 


Field Summary
static int DIRECTION_HORIZONTAL
          the placement direction is horizontal
static int DIRECTION_VERTICAL
          the placement direction is vertical
 
Constructor Summary
SimplePileLayout(int direction)
          Builds a SimplePileLayout with the specified placement direction, with the default gap and with the default margins.
SimplePileLayout(int direction, Insets margins)
          Builds a SimplePileLayout with the specified placement direction, with the default gap and with the specified margins.
SimplePileLayout(int direction, int gap)
          Builds a SimplePileLayout with the specified placement direction and with the specified gap, used also for the margins.
SimplePileLayout(int direction, int gap, Insets margins)
          Builds a SimplePileLayout with the specified placement direction, with the specified gap and with the specified margins.
 
Method Summary
 void addLayoutComponent(String x, Component comp)
           
 void layoutContainer(Container cont)
           
 Dimension minimumLayoutSize(Container cont)
           
 Dimension preferredLayoutSize(Container cont)
           
 void removeLayoutComponent(Component comp)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIRECTION_HORIZONTAL

public static final int DIRECTION_HORIZONTAL
the placement direction is horizontal

See Also:
Constant Field Values

DIRECTION_VERTICAL

public static final int DIRECTION_VERTICAL
the placement direction is vertical

See Also:
Constant Field Values
Constructor Detail

SimplePileLayout

public SimplePileLayout(int direction)
Builds a SimplePileLayout with the specified placement direction, with the default gap and with the default margins.

Parameters:
direction - one of DIRECTION_HORIZONTAL or DIRECTION_VERTICAL

SimplePileLayout

public SimplePileLayout(int direction,
                        int gap)
Builds a SimplePileLayout with the specified placement direction and with the specified gap, used also for the margins.

Parameters:
direction - one of DIRECTION_HORIZONTAL or DIRECTION_VERTICAL
gap - the gap used for component spacing and also for margins

SimplePileLayout

public SimplePileLayout(int direction,
                        Insets margins)
Builds a SimplePileLayout with the specified placement direction, with the default gap and with the specified margins.

Parameters:
direction - one of DIRECTION_HORIZONTAL or DIRECTION_VERTICAL
margins - the margins to use

SimplePileLayout

public SimplePileLayout(int direction,
                        int gap,
                        Insets margins)
Builds a SimplePileLayout with the specified placement direction, with the specified gap and with the specified margins.

Parameters:
direction - one of DIRECTION_HORIZONTAL or DIRECTION_VERTICAL
gap - the gap used for component spacing
margins - the margins to use
Method Detail

addLayoutComponent

public void addLayoutComponent(String x,
                               Component comp)
Specified by:
addLayoutComponent in interface LayoutManager

removeLayoutComponent

public void removeLayoutComponent(Component comp)
Specified by:
removeLayoutComponent in interface LayoutManager

preferredLayoutSize

public Dimension preferredLayoutSize(Container cont)
Specified by:
preferredLayoutSize in interface LayoutManager

minimumLayoutSize

public Dimension minimumLayoutSize(Container cont)
Specified by:
minimumLayoutSize in interface LayoutManager

layoutContainer

public void layoutContainer(Container cont)
Specified by:
layoutContainer in interface LayoutManager


Copyright © 2006,2007 Roberto Mariottini. All Rights Reserved.