public final class PlatformDefaults
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
BASE_FONT_SIZE
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.
|
static int |
BASE_REAL_PIXEL
I value indicating that the size of a logical pixel should always be a real pixel
and thus no compensation will be made.
|
static int |
BASE_SCALE_FACTOR
I value indicating that the screen DPI will be used as a base for calculating the
logical pixel size.
|
static int |
GNOME |
static int |
MAC_OSX |
static int |
WINDOWS_XP |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getButtonOrder()
Returns the order for the typical buttons in a standard button bar.
|
static int |
getCurrentPlatform()
Returns the platform that the JRE is running on currently.
|
static int |
getDefaultDPI() |
static int |
getDefaultHorizontalUnit()
Returns the current default unit.
|
static boolean |
getDefaultRowAlignmentBaseline()
The default alignment for rows.
|
static int |
getDefaultVerticalUnit()
Returns the current default unit.
|
static java.lang.Float |
getHorizontalScaleFactor()
The forced scale factor that all screen relative units (e.g. millimeters, inches and logical pixels) will be multiplied
with.
|
static IPlatformDefaults |
getInstance() |
static float |
getLabelAlignPercentage()
Returns the percentage used for alignment for labels (0 is left, 50 is center and 100 is right).
|
static int |
getLogicalPixelBase()
What base value should be used to calculate logical pixel sizes.
|
static int |
getModCount()
Returns how many times the defaults has been changed.
|
static int |
getPlatform()
Returns the current platform
|
static java.lang.Float |
getVerticalScaleFactor()
The forced scale factor that all screen relative units (e.g. millimeters, inches and logical pixels) will be multiplied
with.
|
static void |
invalidate()
Tells all layout manager instances to revalidate and recalculated everything.
|
static void |
setButtonOrder(java.lang.String order)
Sets the order for the typical buttons in a standard button bar.
|
static void |
setDefaultDPI(java.lang.Integer dpi)
Sets the default platform DPI.
|
static void |
setDefaultHorizontalUnit(int unit)
Sets the default unit.
|
static void |
setDefaultRowAlignmentBaseline(boolean b)
The default alignment for rows.
|
static void |
setDefaultVerticalUnit(int unit)
Sets the default unit.
|
static void |
setHorizontalScaleFactor(java.lang.Float f)
The forced scale factor that all screen relative units (e.g. millimeters, inches and logical pixels) will be multiplied
with.
|
static void |
setLogicalPixelBase(int base)
What base value should be used to calculate logical pixel sizes.
|
static void |
setPlatform(int plaf)
Set the defaults to the default for the platform
|
static void |
setVerticalScaleFactor(java.lang.Float f)
The forced scale factor that all screen relative units (e.g. millimeters, inches and logical pixels) will be multiplied
with.
|
public static final int WINDOWS_XP
public static final int MAC_OSX
public static final int GNOME
public static final int BASE_FONT_SIZE
net.miginfocom.layout.UnitValue#LPX
,
net.miginfocom.layout.UnitValue#LPY
,
setLogicalPixelBase(int)
,
Constant Field Valuespublic static final int BASE_SCALE_FACTOR
This is the default value.
net.miginfocom.layout.UnitValue#LPX
,
net.miginfocom.layout.UnitValue#LPY
,
setLogicalPixelBase(int)
,
setVerticalScaleFactor(Float)
,
setHorizontalScaleFactor(Float)
,
Constant Field Valuespublic static final int BASE_REAL_PIXEL
net.miginfocom.layout.UnitValue#LPX
,
net.miginfocom.layout.UnitValue#LPY
,
setLogicalPixelBase(int)
,
Constant Field Valuespublic static IPlatformDefaults getInstance()
public static int getCurrentPlatform()
MAC_OSX
, WINDOWS_XP
, or GNOME
.public static void setPlatform(int plaf)
plaf
- The platform. PlatformDefaults.WINDOWS_XP
, PlatformDefaults.MAC_OSX
, or
PlatformDefaults.GNOME
.public static int getPlatform()
PlatformDefaults.WINDOWS
or PlatformDefaults.MAC_OSX
public static int getDefaultDPI()
public static void setDefaultDPI(java.lang.Integer dpi)
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.
dpi
- The base DPI. If null the default DPI is reset to the platform base DPI.public static java.lang.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).null
for default scaling.getHorizontalScaleFactor()
,
ComponentWrapper#getHorizontalScreenDPI()
public static void setHorizontalScaleFactor(java.lang.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).f
- The forced scale or null
for default scaling.getHorizontalScaleFactor()
,
ComponentWrapper#getHorizontalScreenDPI()
public static java.lang.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).null
for default scaling.getHorizontalScaleFactor()
,
ComponentWrapper#getVerticalScreenDPI()
public static void setVerticalScaleFactor(java.lang.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).f
- The forced scale or null
for default scaling.getHorizontalScaleFactor()
,
ComponentWrapper#getVerticalScreenDPI()
public static int getLogicalPixelBase()
BASE_SCALE_FACTOR
BASE_FONT_SIZE
,
BASE_SCREEN_DPI_FACTOR
,
BASE_REAL_PIXEL
public static void setLogicalPixelBase(int base)
base
- The new base. Default is BASE_SCALE_FACTOR
BASE_FONT_SIZE
,
BASE_SCREEN_DPI_FACTOR
,
BASE_REAL_PIXEL
public static java.lang.String getButtonOrder()
setButtonOrder(String)
public static void setButtonOrder(java.lang.String order)
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"
.
order
- The new button order for the current platform.public static float getLabelAlignPercentage()
public static int getModCount()
public static void invalidate()
public static int getDefaultHorizontalUnit()
net.miginfocom.layout.UnitValue#PIXEL
,
net.miginfocom.layout.UnitValue#LPX
public static void setDefaultHorizontalUnit(int unit)
unit
- The new default unit.net.miginfocom.layout.UnitValue#PIXEL
,
net.miginfocom.layout.UnitValue#LPX
public static int getDefaultVerticalUnit()
net.miginfocom.layout.UnitValue#PIXEL
,
net.miginfocom.layout.UnitValue#LPY
public static void setDefaultVerticalUnit(int unit)
unit
- The new default unit.net.miginfocom.layout.UnitValue#PIXEL
,
net.miginfocom.layout.UnitValue#LPY
public static boolean getDefaultRowAlignmentBaseline()
false
but now it is true
.true
.public static void setDefaultRowAlignmentBaseline(boolean b)
false
but now it is true
.b
- The new value. Default is true
from v3.5.Siehe auch Jowidgets Nutzerhandbuch