com.townleyenterprises.swing
Class SpringHints

java.lang.Object
  extended bycom.townleyenterprises.swing.SpringHints

public class SpringHints
extends java.lang.Object

This class is used to provide per-component layout hints to the SpringUtils utility class. This class describes the component's layout constraints in a similar manner to the way you can describe component layout behavior in the NEXTSTEP/MacOS X InterfaceBuilder application.

To use this class, create a new instance and put it on the component to be layed out using the JComponent.putClientProperty(java.lang.Object, java.lang.Object) method. The SpringUtils class will attempt to access this information before applying the layout.

The following example illustrates this use:

	JPanel container = new JPanel(new SpringLayout());
 	JLabel label = new JLabel("Label:");
 	JTextField text = new JTextField();
 	
 	// add the spring hints
 	text.putClientProperty(SpringHints.PROPERTY,
 			new SpringHints(true, false));

 	container.add(label);
 	container.add(text);

	SpringUtils.applyLayout(content, 2, 2, 6, 6, 12, 6);
 

Since:
2.1
Version:
$Id: SpringHints.java,v 1.3 2004/07/28 10:33:59 atownley Exp $
Author:
Andrew S. Townley

Field Summary
static java.lang.String PROPERTY
          this is the property name used to access the hints instances on the component
 
Constructor Summary
SpringHints(boolean springWidth, boolean springHeight)
          This version of the constructor specifies the internal "springy-ness" of the component.
SpringHints(boolean springNorth, boolean springSouth, boolean springEast, boolean springWest, boolean springWidth, boolean springHeight)
          This version of the constructor specifies the complete ways that the component may be affected by the springs.
 
Method Summary
 boolean getSpringEast()
           
 boolean getSpringHeight()
           
 boolean getSpringNorth()
           
 boolean getSpringSouth()
           
 boolean getSpringWest()
           
 boolean getSpringWidth()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY

public static final java.lang.String PROPERTY
this is the property name used to access the hints instances on the component

See Also:
Constant Field Values
Constructor Detail

SpringHints

public SpringHints(boolean springWidth,
                   boolean springHeight)
This version of the constructor specifies the internal "springy-ness" of the component.

Parameters:
springWidth - true to say the component can expand in width
springHeight - true to say if the component can expand in height

SpringHints

public SpringHints(boolean springNorth,
                   boolean springSouth,
                   boolean springEast,
                   boolean springWest,
                   boolean springWidth,
                   boolean springHeight)
This version of the constructor specifies the complete ways that the component may be affected by the springs.

Parameters:
springNorth - true if the top of the component can move relative to the container
springSouth - true if the bottom of the component can move relative to the container
springEast - true if the right side of the component can move relative to the container
springWest - true if the left side of the component can move relative to the container
springWidth - true to say the component can expand in width
springHeight - true to say if the component can expand in height
Method Detail

getSpringNorth

public boolean getSpringNorth()

getSpringSouth

public boolean getSpringSouth()

getSpringEast

public boolean getSpringEast()

getSpringWest

public boolean getSpringWest()

getSpringWidth

public boolean getSpringWidth()

getSpringHeight

public boolean getSpringHeight()

toString

public java.lang.String toString()


Copyright © 2002-2004, Andrew S. Townley and Townley Enterprises. All Rights Reserved.
This project is hosted on http://te-code.sourceforge.net.