| java.lang.Object org.jdesktop.layout.Baseline
Baseline | public class Baseline (Code) | | Convenience class that can be used to determine the baseline of a
particular component. The static method getBaseline uses the
following algorithm to determine the baseline:
- If the component has a
getBaseline(Component,int,int)
method, invoke it.
- If there is a
UIManager property of the name
Baseline.instance , forward the call to that Baseline.
- Otherwise use the built in support.
This class is primarily useful for JREs prior to 1.6. In 1.6 API for this
was added directly to Component, Component and the
appropriate ComponentUIs. When run on a JRE of 1.6 or greater this will directly
call into the getBaseline method of Component.
version: $Revision$ |
Constructor Summary | |
protected | Baseline() Creates an instance of Baseline. |
Method Summary | |
public static int | getBaseline(Component component) Returns the baseline for the specified component, or -1 if the
baseline can not be determined. | public static int | getBaseline(Component component, int width, int height) Returns the baseline for the specified component, or a value less
than 0 if the baseline can not be determined. | public int | getComponentBaseline(Component component, int width, int height) Returns the baseline for the specified component, or -1 if the
baseline can not be determined. |
Baseline | protected Baseline()(Code) | | Creates an instance of Baseline. You typically don't create a
Baseline. The constructor is provided by look and feels that wish
to provide baseline support.
A custom look and feel that wants to provide Baseline
support should put the instance in the defaults returned
from getDefaults . If you want to override the
baseline suport for a look and feel place the instance in the defaults
returned from UIManager.getLookAndFeelDefaults(). Tthis will ensure
that if the look and feel changes the appropriate baseline can be used.
|
getBaseline | public static int getBaseline(Component component)(Code) | | Returns the baseline for the specified component, or -1 if the
baseline can not be determined. The baseline is measured from
the top of the component. This method returns the baseline based
on the preferred size.
Parameters: component - Component to calculate baseline for baseline for the specified component |
getBaseline | public static int getBaseline(Component component, int width, int height)(Code) | | Returns the baseline for the specified component, or a value less
than 0 if the baseline can not be determined. The baseline is measured
from the top of the component.
Parameters: component - Component to calculate baseline for Parameters: width - Width of the component to determine baseline for. Parameters: height - Height of the component to determine baseline for. baseline for the specified component |
getComponentBaseline | public int getComponentBaseline(Component component, int width, int height)(Code) | | Returns the baseline for the specified component, or -1 if the
baseline can not be determined. The baseline is measured from
the top of the component.
Parameters: component - Component to calculate baseline for Parameters: width - Width of the component to determine baseline for. Parameters: height - Height of the component to determine baseline for. baseline for the specified component |
|
|