public final class PlatformDefaults
- Object
- PlatformDefaults
Fields
public static final int WINDOWS_XP = 0 | |
public static final int MAC_OSX = 1 | |
public static final int GNOME = 2 | |
public static final int BASE_FONT_SIZE = 100 | I value indicating that the size of the font for the container of the component will be used as a base for calculating the logical pixel size. |
public static final int BASE_SCALE_FACTOR = 101 | I value indicating that the screen DPI will be used as a base for calculating the logical pixel size. |
public static final int BASE_REAL_PIXEL = 102 | I value indicating that the size of a logical pixel should always be a real pixel and thus no compensation will be made. |
public static final String VISUAL_PADDING_PROPERTY = "visualPadding" | Property to use in LAF settings and as JComponent client property to specify the visual padding. |
Methods
Inherited methods
Field details
WINDOWS_XP
public static final int WINDOWS_XP = 0MAC_OSX
public static final int MAC_OSX = 1GNOME
public static final int GNOME = 2BASE_FONT_SIZE
public static final int BASE_FONT_SIZE = 100See also
net.miginfocom.layout.UnitValue#LPXnet.miginfocom.layout.UnitValue#LPY#setLogicalPixelBase(int)
BASE_SCALE_FACTOR
public static final int BASE_SCALE_FACTOR = 101I value indicating that the screen DPI will be used as a base for calculating the logical pixel size.
This is the default value.
See also
net.miginfocom.layout.UnitValue#LPXnet.miginfocom.layout.UnitValue#LPY#setLogicalPixelBase(int)#setVerticalScaleFactor(Float)#setHorizontalScaleFactor(Float)
BASE_REAL_PIXEL
public static final int BASE_REAL_PIXEL = 102See also
net.miginfocom.layout.UnitValue#LPXnet.miginfocom.layout.UnitValue#LPY#setLogicalPixelBase(int)
VISUAL_PADDING_PROPERTY
public static final String VISUAL_PADDING_PROPERTY = "visualPadding"Method details
getCurrentPlatform
public static int getCurrentPlatform()Returns
#MAC_OSX, #WINDOWS_XP, or #GNOME.setDefaultVisualPadding
public static void setDefaultVisualPadding(String key, int[] insets)Parameters
keyString- The component type. E.g. “TabbedPane.visualPadding” or “ComboBox.editable.isSquare.visualPadding”. See source code for list.
insetsint[]- Top, left, bottom, right. Always length 4 or null.
See also
net.miginfocom.layout.ComponentWrapper#getVisualPadding()
getDefaultVisualPadding
public static int[] getDefaultVisualPadding(String key)Parameters
keyString- The component type. E.g. “TabbedPane.visualPadding” or “ComboBox.editable.isSquare.visualPadding”. See source code for list.
Returns
See also
net.miginfocom.layout.ComponentWrapper#getVisualPadding()
getPlatformDPI
public static int getPlatformDPI(int plaf)getPlatform
public static int getPlatform()Returns
PlatformDefaults.WINDOWS or PlatformDefaults.MAC_OSXsetPlatform
public static void setPlatform(int plaf)Parameters
plafint- The platform.
PlatformDefaults.WINDOWS_XP,PlatformDefaults.MAC_OSX, orPlatformDefaults.GNOME.
getDefaultDPI
public static int getDefaultDPI()setDefaultDPI
public static void setDefaultDPI(Integer dpi)Sets the default platform DPI. Normally this is set in the #setPlatform(int) for the different platforms
but it can be tweaked here. For instance SWT on Mac does this.
Note that this is not the actual current DPI, but the base DPI for the toolkit.
Parameters
dpiInteger- The base DPI. If null the default DPI is reset to the platform base DPI.
getHorizontalScaleFactor
public static Float getHorizontalScaleFactor()null this will default to a scale that will scale the current screen to the default screen resolution
(72 DPI for Mac and 92 DPI for Windows).Returns
null for default scaling.setHorizontalScaleFactor
public static void setHorizontalScaleFactor(Float f)null this will default to a scale that will scale the current screen to the default screen resolution
(72 DPI for Mac and 92 DPI for Windows).Parameters
fFloat- The forced scale or
nullfor default scaling.
getVerticalScaleFactor
public static Float getVerticalScaleFactor()null this will default to a scale that will scale the current screen to the default screen resolution
(72 DPI for Mac and 92 DPI for Windows).Returns
null for default scaling.setVerticalScaleFactor
public static void setVerticalScaleFactor(Float f)null this will default to a scale that will scale the current screen to the default screen resolution
(72 DPI for Mac and 92 DPI for Windows).Parameters
fFloat- The forced scale or
nullfor default scaling.
getLogicalPixelBase
public static int getLogicalPixelBase()Returns
#BASE_SCALE_FACTORsetLogicalPixelBase
public static void setLogicalPixelBase(int base)Parameters
baseint- The new base. Default is
#BASE_SCALE_FACTOR
setRelatedGap
public static void setRelatedGap(UnitValue x, UnitValue y)Parameters
xUnitValue- The value that will be transformed to pixels. If
nullthe current value will not change. yUnitValue- The value that will be transformed to pixels. If
nullthe current value will not change.
setParagraphGap
public static void setParagraphGap(UnitValue x, UnitValue y)Parameters
xUnitValue- The value that will be transformed to pixels. If
nullthe current value will not change. yUnitValue- The value that will be transformed to pixels. If
nullthe current value will not change.
setIndentGap
public static void setIndentGap(UnitValue x, UnitValue y)Parameters
xUnitValue- The value that will be transformed to pixels. If
nullthe current value will not change. yUnitValue- The value that will be transformed to pixels. If
nullthe current value will not change.
setGridCellGap
public static void setGridCellGap(UnitValue x, UnitValue y)Parameters
xUnitValue- The value that will be transformed to pixels. If
nullthe current value will not change. yUnitValue- The value that will be transformed to pixels. If
nullthe current value will not change.
getMinimumButtonWidth
public static UnitValue getMinimumButtonWidth()Returns
setMinimumButtonWidth
public static void setMinimumButtonWidth(UnitValue width)Parameters
widthUnitValue- The recommended minimum button width.
getUnitValueX
public static UnitValue getUnitValueX(String unit)Parameters
unitString- The unit string.
Returns
null for unrecognized units.getUnitValueY
public static UnitValue getUnitValueY(String unit)Parameters
unitString- The unit string.
Returns
null for unrecognized units.setUnitValue
public static void setUnitValue(String[] unitStrings, UnitValue x, UnitValue y)Parameters
unitStringsString[]- The unit strings. E.g. “mu”, “myunit”. Will be converted to lower case and trimmed. Not
null. xUnitValue- The value for the horizontal dimension. If
nullthe value is not changed. yUnitValue- The value for the vertical dimension. Might be same object as for
x. Ifnullthe value is not changed.
getButtonOrder
public static String getButtonOrder()Returns
See also
setButtonOrder
public static void setButtonOrder(String order)Sets the order for the typical buttons in a standard button bar. It is one letter per button type.
Letter in upper case will get the minimum button width that the #getMinimumButtonWidth() specifies
and letters in lower case will get the width the current look&feel specifies.
Gaps will never be added to before the first component or after the last component. However, ‘+’ (push) will be applied before and after as well, but with a minimum size of 0 if first/last so there will not be a gap before or after.
If gaps are explicitly set on buttons they will never be reduced, but they may be increased.
These are the characters that can be used:
'L'- Buttons with this style tag will staticall end up on the left end of the bar.'R'- Buttons with this style tag will staticall end up on the right end of the bar.'H'- A tag for the “help” button that normally is supposed to be on the right.'E'- A tag for the “help2” button that normally is supposed to be on the left.'Y'- A tag for the “yes” button.'N'- A tag for the “no” button.'X'- A tag for the “next >” or “forward >” button.'B'- A tag for the “< back>” or “< previous” button.'I'- A tag for the “finish”.'A'- A tag for the “apply” button.'C'- A tag for the “cancel” or “close” button.'O'- A tag for the “ok” or “done” button.'U'- All Uncategorized, Other, or “Unknown” buttons. Tag will be “other”.'+'- A glue push gap that will take as much space as it can and at least an “unrelated” gap. (Platform dependant)'_'- (underscore) An “unrelated” gap. (Platform dependant)
Even though the style tags are normally applied to buttons this works with all components.
The normal style for MAC OS X is "L_HE+U+FBI_NYCOA_R",
for Windows is "L_E+U+FBI_YNOCAH_R", and for GNOME is
"L_HE+UNYACBXIO_R".
Parameters
orderString- The new button order for the current platform.
getGridGapX
public static BoundSize getGridGapX()Returns
getGridGapY
public static BoundSize getGridGapY()Returns
getDialogInsets
public static UnitValue getDialogInsets(int side)Parameters
sideint- top == 0, left == 1, bottom = 2, right = 3.
Returns
null.setDialogInsets
public static void setDialogInsets(UnitValue top, UnitValue left, UnitValue bottom, UnitValue right)Parameters
topUnitValue- The top inset. May be
null. leftUnitValue- The left inset. May be
null. bottomUnitValue- The bottom inset. May be
null. rightUnitValue- The right inset. May be
null.
getPanelInsets
public static UnitValue getPanelInsets(int side)Parameters
sideint- top == 0, left == 1, bottom = 2, right = 3.
Returns
null.setPanelInsets
public static void setPanelInsets(UnitValue top, UnitValue left, UnitValue bottom, UnitValue right)Parameters
topUnitValue- The top inset. May be
null. leftUnitValue- The left inset. May be
null. bottomUnitValue- The bottom inset. May be
null. rightUnitValue- The right inset. May be
null.
getLabelAlignPercentage
public static float getLabelAlignPercentage()Returns
getGapProvider
public static InCellGapProvider getGapProvider()null if none is set and “related” should always be used.Returns
null if none is set and “related” should always be used.setGapProvider
public static void setGapProvider(InCellGapProvider provider)null if none is set and “related” should always be used.Parameters
providerInCellGapProvider- The current gap provider or
nullif none is set and “related” should always be used.
getModCount
public static int getModCount()Returns
getDefaultHorizontalUnit
public static int getDefaultHorizontalUnit()Returns
See also
setDefaultHorizontalUnit
public static void setDefaultHorizontalUnit(int unit)Parameters
unitint- The new default unit.
See also
getDefaultVerticalUnit
public static int getDefaultVerticalUnit()Returns
See also
setDefaultVerticalUnit
public static void setDefaultVerticalUnit(int unit)Parameters
unitint- The new default unit.
See also
getDefaultRowAlignmentBaseline
public static boolean getDefaultRowAlignmentBaseline()false but now it is
true.Returns
true.setDefaultRowAlignmentBaseline
public static void setDefaultRowAlignmentBaseline(boolean b)false but now it is
true.Parameters
bboolean- The new value. Default is
truefrom v3.5.
invalidate
public void invalidate()