SwingComponentWrapper (MiGLayout 4.0 API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="SwingComponentWrapper (MiGLayout 4.0 API)";
}
}
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
net.miginfocom.swing
Class SwingComponentWrapper
java.lang.Object
net.miginfocom.swing.SwingComponentWrapper
All Implemented Interfaces: ComponentWrapper
Direct Known Subclasses: SwingContainerWrapper
public class SwingComponentWrapperextends java.lang.Objectimplements ComponentWrapper
Field Summary
Fields inherited from interface net.miginfocom.layout.ComponentWrapper
TYPE_BUTTON, TYPE_CHECK_BOX, TYPE_COMBO_BOX, TYPE_CONTAINER, TYPE_IMAGE, TYPE_LABEL, TYPE_LIST, TYPE_PANEL, TYPE_PROGRESS_BAR, TYPE_SCROLL_BAR, TYPE_SCROLL_PANE, TYPE_SEPARATOR, TYPE_SLIDER, TYPE_SPINNER, TYPE_TABLE, TYPE_TEXT_AREA, TYPE_TEXT_FIELD, TYPE_TREE, TYPE_UNKNOWN, TYPE_UNSET
Constructor Summary
SwingComponentWrapper(java.awt.Component c)
Method Summary
boolean
equals(java.lang.Object o)
int
getBaseline(int width,
int height)
Returns the baseline for the component given the suggested height.
java.lang.Object
getComponent()
Returns the actual object that this wrapper is aggregating.
int
getComponetType(boolean disregardScrollPane)
Returns the type of component that this wrapper is wrapping.
int
getHeight()
Returns the current height for this component.
int
getHorizontalScreenDPI()
Returns the DPI (Dots Per Inch) of the screen the component is currently in or for the default
screen if the component is not visible.
int
getLayoutHashCode()
Returns a hash code that should be reasonably different for anything that might change the layout.
java.lang.String
getLinkId()
Returns a String id that can be used to reference the component in link constraints.
int
getMaximumHeight(int sz)
Returns the maximum height of the component.
int
getMaximumWidth(int sz)
Returns the maximum width of the component.
int
getMinimumHeight(int sz)
Returns the minimum height of the component.
int
getMinimumWidth(int sz)
Returns the minimum width of the component.
ContainerWrapper
getParent()
Returns the container for this component.
float
getPixelUnitFactor(boolean isHor)
Returns the pixel unit factor for the horizontal or vertical dimension.
int
getPreferredHeight(int sz)
Returns the preferred height of the component.
int
getPreferredWidth(int sz)
Returns the preferred width of the component.
int
getScreenHeight()
Returns the pixel size of the screen that the component is currently in or for the default
screen if the component is not visible or null.
int
getScreenLocationX()
Returns the screen x-coordinate for the upper left coordinate of the component layout-able bounds.
int
getScreenLocationY()
Returns the screen y-coordinate for the upper left coordinate of the component layout-able bounds.
int
getScreenWidth()
Returns the pixel size of the screen that the component is currently in or for the default
screen if the component is not visible or null.
int
getVerticalScreenDPI()
Returns the DPI (Dots Per Inch) of the screen the component is currently in or for the default
screen if the component is not visible.
int[]
getVisualPadding()
Returns the padding on a component by component basis.
int
getWidth()
Returns the current width for this component.
int
getX()
Returns the current x coordinate for this component.
int
getY()
Returns the current y coordinate for this component.
boolean
hasBaseline()
Returns if the component has a baseline and if it can be retrieved.
int
hashCode()
static boolean
isMaxSizeSetOn1_4()
boolean
isVisible()
Returns if the component's visibility is set to true.
static boolean
isVisualPaddingEnabled()
void
paintDebugOutline()
Paints component outline to indicate where it is.
void
setBounds(int x,
int y,
int width,
int height)
Sets the component's bounds.
static void
setMaxSizeSetOn1_4(boolean b)
static void
setVisualPaddingEnabled(boolean b)
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Constructor Detail
SwingComponentWrapper
public SwingComponentWrapper(java.awt.Component c)
Method Detail
getBaseline
public final int getBaseline(int width,
int height)
Description copied from interface: ComponentWrapper
Returns the baseline for the component given the suggested height.
Specified by:getBaseline in interface ComponentWrapper
Parameters:width - The width to calculate for if other than the current. If -1 the current size should be used.height - The height to calculate for if other than the current. If -1 the current size should be used.
Returns:The baseline from the top or -1 if not applicable.
getComponent
public final java.lang.Object getComponent()
Description copied from interface: ComponentWrapper
Returns the actual object that this wrapper is aggregating. This might be needed for getting
information about the object that the wrapper interface does not provide.
If this is a container the container should be returned instead.
Specified by:getComponent in interface ComponentWrapper
Returns:The actual object that this wrapper is aggregating. Not null.
getPixelUnitFactor
public final float getPixelUnitFactor(boolean isHor)
Description copied from interface: ComponentWrapper
Returns the pixel unit factor for the horizontal or vertical dimension.
The factor is 1 for both dimensions on the normal font in a JPanel on Windows. The factor should increase with a bigger "X".
This is the Swing version:
Rectangle2D r = fm.getStringBounds("X", parent.getGraphics());
wFactor = r.getWidth() / 6;
hFactor = r.getHeight() / 13.27734375f;
Specified by:getPixelUnitFactor in interface ComponentWrapper
Parameters:isHor - If it is the horizontal factor that should be returned.
Returns:The factor.
getX
public final int getX()
Description copied from interface: ComponentWrapper
Returns the current x coordinate for this component.
Specified by:getX in interface ComponentWrapper
Returns:The current x coordinate for this component.
getY
public final int getY()
Description copied from interface: ComponentWrapper
Returns the current y coordinate for this component.
Specified by:getY in interface ComponentWrapper
Returns:The current y coordinate for this component.
getHeight
public final int getHeight()
Description copied from interface: ComponentWrapper
Returns the current height for this component.
Specified by:getHeight in interface ComponentWrapper
Returns:The current height for this component.
getWidth
public final int getWidth()
Description copied from interface: ComponentWrapper
Returns the current width for this component.
Specified by:getWidth in interface ComponentWrapper
Returns:The current width for this component.
getScreenLocationX
public final int getScreenLocationX()
Description copied from interface: ComponentWrapper
Returns the screen x-coordinate for the upper left coordinate of the component layout-able bounds.
Specified by:getScreenLocationX in interface ComponentWrapper
Returns:The screen x-coordinate for the upper left coordinate of the component layout-able bounds.
getScreenLocationY
public final int getScreenLocationY()
Description copied from interface: ComponentWrapper
Returns the screen y-coordinate for the upper left coordinate of the component layout-able bounds.
Specified by:getScreenLocationY in interface ComponentWrapper
Returns:The screen y-coordinate for the upper left coordinate of the component layout-able bounds.
getMinimumHeight
public final int getMinimumHeight(int sz)
Description copied from interface: ComponentWrapper
Returns the minimum height of the component.
Specified by:getMinimumHeight in interface ComponentWrapper
Parameters:sz - The Size hint for the other dimension. An implementation can use this value or the
current size for the widget in this dimension, or a combination of both, to calculate the correct size.
Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
Returns:The minimum height of the component.
getMinimumWidth
public final int getMinimumWidth(int sz)
Description copied from interface: ComponentWrapper
Returns the minimum width of the component.
Specified by:getMinimumWidth in interface ComponentWrapper
Parameters:sz - The Size hint for the other dimension. An implementation can use this value or the
current size for the widget in this dimension, or a combination of both, to calculate the correct size.
Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
Returns:The minimum width of the component.
getPreferredHeight
public final int getPreferredHeight(int sz)
Description copied from interface: ComponentWrapper
Returns the preferred height of the component.
Specified by:getPreferredHeight in interface ComponentWrapper
Parameters:sz - The Size hint for the other dimension. An implementation can use this value or the
current size for the widget in this dimension, or a combination of both, to calculate the correct size.
Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
Returns:The preferred height of the component.
getPreferredWidth
public final int getPreferredWidth(int sz)
Description copied from interface: ComponentWrapper
Returns the preferred width of the component.
Specified by:getPreferredWidth in interface ComponentWrapper
Parameters:sz - The Size hint for the other dimension. An implementation can use this value or the
current size for the widget in this dimension, or a combination of both, to calculate the correct size.
Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
Returns:The preferred width of the component.
getMaximumHeight
public final int getMaximumHeight(int sz)
Description copied from interface: ComponentWrapper
Returns the maximum height of the component.
Specified by:getMaximumHeight in interface ComponentWrapper
Parameters:sz - The Size hint for the other dimension. An implementation can use this value or the
current size for the widget in this dimension, or a combination of both, to calculate the correct size.
Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
Returns:The maximum height of the component.
getMaximumWidth
public final int getMaximumWidth(int sz)
Description copied from interface: ComponentWrapper
Returns the maximum width of the component.
Specified by:getMaximumWidth in interface ComponentWrapper
Parameters:sz - The Size hint for the other dimension. An implementation can use this value or the
current size for the widget in this dimension, or a combination of both, to calculate the correct size.
Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
Returns:The maximum width of the component.
getParent
public final ContainerWrapper getParent()
Description copied from interface: ComponentWrapper
Returns the container for this component.
Specified by:getParent in interface ComponentWrapper
Returns:The container for this component. Will return null if the component has no parent.
getHorizontalScreenDPI
public final int getHorizontalScreenDPI()
Description copied from interface: ComponentWrapper
Returns the DPI (Dots Per Inch) of the screen the component is currently in or for the default
screen if the component is not visible.
If headless mode PlatformDefaults.getDefaultDPI() will be returned.
Specified by:getHorizontalScreenDPI in interface ComponentWrapper
Returns:The DPI.
getVerticalScreenDPI
public final int getVerticalScreenDPI()
Description copied from interface: ComponentWrapper
Returns the DPI (Dots Per Inch) of the screen the component is currently in or for the default
screen if the component is not visible.
If headless mode PlatformDefaults.getDefaultDPI() will be returned.
Specified by:getVerticalScreenDPI in interface ComponentWrapper
Returns:The DPI.
getScreenWidth
public final int getScreenWidth()
Description copied from interface: ComponentWrapper
Returns the pixel size of the screen that the component is currently in or for the default
screen if the component is not visible or null.
If in headless mode 1024 is returned.
Specified by:getScreenWidth in interface ComponentWrapper
Returns:The screen size. E.g. 1280.
getScreenHeight
public final int getScreenHeight()
Description copied from interface: ComponentWrapper
Returns the pixel size of the screen that the component is currently in or for the default
screen if the component is not visible or null.
If in headless mode 768 is returned.
Specified by:getScreenHeight in interface ComponentWrapper
Returns:The screen size. E.g. 1024.
hasBaseline
public final boolean hasBaseline()
Description copied from interface: ComponentWrapper
Returns if the component has a baseline and if it can be retrieved. Should for instance return
false for Swing before mustang.
Specified by:hasBaseline in interface ComponentWrapper
Returns:If the component has a baseline and if it can be retrieved.
getLinkId
public final java.lang.String getLinkId()
Description copied from interface: ComponentWrapper
Returns a String id that can be used to reference the component in link constraints. This value should
return the default id for the component. The id can be set for a component in the constraints and if
so the value returned by this method will never be used. If there are no sensible id for the component
null should be returned.
For instance the Swing implementation returns the string returned from Component.getName().
Specified by:getLinkId in interface ComponentWrapper
Returns:The string link id or null.
setBounds
public final void setBounds(int x,
int y,
int width,
int height)
Description copied from interface: ComponentWrapper
Sets the component's bounds.
Specified by:setBounds in interface ComponentWrapper
Parameters:x - The x coordinate.y - The y coordinate.width - The width.height - The height.
isVisible
public boolean isVisible()
Description copied from interface: ComponentWrapper
Returns if the component's visibility is set to true. This should not return if the component is
actually visible, but if the visibility is set to true or not.
Specified by:isVisible in interface ComponentWrapper
Returns:true means visible.
getVisualPadding
public final int[] getVisualPadding()
Description copied from interface: ComponentWrapper
Returns the padding on a component by component basis. This method can be overridden to return padding to compensate for example for
borders that have shadows or where the outer most pixel is not the visual "edge" to align to.
Default implementation returns null for all components except for Windows XP's JTabbedPane which will return new Insets(0, 0, 2, 2).
NOTE! To reduce generated garbage the returned padding should never be changed so that the same insets can be returned many times.
Specified by:getVisualPadding in interface ComponentWrapper
Returns:null if no padding. NOTE! To reduce generated garbage the returned padding should never be changed so that
the same insets can be returned many times. [top, left, bottom, right]
isMaxSizeSetOn1_4
public static boolean isMaxSizeSetOn1_4()
setMaxSizeSetOn1_4
public static void setMaxSizeSetOn1_4(boolean b)
isVisualPaddingEnabled
public static boolean isVisualPaddingEnabled()
setVisualPaddingEnabled
public static void setVisualPaddingEnabled(boolean b)
paintDebugOutline
public final void paintDebugOutline()
Description copied from interface: ComponentWrapper
Paints component outline to indicate where it is.
Specified by:paintDebugOutline in interface ComponentWrapper
getComponetType
public int getComponetType(boolean disregardScrollPane)
Description copied from interface: ComponentWrapper
Returns the type of component that this wrapper is wrapping.
This method can be invoked often so the result should be cached.
NOTE! This is misspelled. Keeping it that way though since this is only used by developers who
port MigLayout.
Specified by:getComponetType in interface ComponentWrapper
Parameters:disregardScrollPane - Is true any wrapping scroll pane should be disregarded and the type
of the scrolled component should be returned.
Returns:The type of component that this wrapper is wrapping. E.g. ComponentWrapper.TYPE_LABEL.
getLayoutHashCode
public int getLayoutHashCode()
Description copied from interface: ComponentWrapper
Returns a hash code that should be reasonably different for anything that might change the layout. This value is used to
know if the component layout needs to clear any caches.
Specified by:getLayoutHashCode in interface ComponentWrapper
Returns:A hash code that should be reasonably different for anything that might change the layout. Returns -1 if the widget is
disposed.
hashCode
public final int hashCode()
Overrides:hashCode in class java.lang.Object
equals
public final boolean equals(java.lang.Object o)
Overrides:equals in class java.lang.Object
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
Copyright © 2007-2011. All Rights Reserved.
Wyszukiwarka
Podobne podstrony:
SwingConstantsSwingConstantsSwingContainerWrapperwięcej podobnych podstron