本文整理汇总了Java中net.miginfocom.layout.PlatformDefaults类的典型用法代码示例。如果您正苦于以下问题:Java PlatformDefaults类的具体用法?Java PlatformDefaults怎么用?Java PlatformDefaults使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlatformDefaults类属于net.miginfocom.layout包,在下文中一共展示了PlatformDefaults类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPixelUnitFactor
import net.miginfocom.layout.PlatformDefaults; //导入依赖的package包/类
public final float getPixelUnitFactor(boolean isHor) {
switch (PlatformDefaults.getLogicalPixelBase()) {
case PlatformDefaults.BASE_FONT_SIZE:
BitmapFont bmf = getFont();
if (bmf == null) {
return 1f;
}
float f = isHor ? bmf.getLineWidth("W") / 5f : bmf.getPreferredSize() / 13f;
return f;
case PlatformDefaults.BASE_SCALE_FACTOR:
Float s = isHor ? PlatformDefaults.getHorizontalScaleFactor() : PlatformDefaults.getVerticalScaleFactor();
if (s != null) {
return s.floatValue();
}
return (isHor ? getHorizontalScreenDPI() : getVerticalScreenDPI())
/ (float) PlatformDefaults.getDefaultDPI();
default:
return 1f;
}
}
示例2: init
import net.miginfocom.layout.PlatformDefaults; //导入依赖的package包/类
@Override
public void init() {
JDialog.setDefaultLookAndFeelDecorated(true);
JFrame.setDefaultLookAndFeelDecorated(true);
try {
UIManager.setLookAndFeel(lookAndFeel);
initUIDefaults();
initButtonsKeyBinding();
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException
| UnsupportedLookAndFeelException e) {
throw new RuntimeException(e);
}
if (marginSize != null) {
UnitValue marginValue = new UnitValue(marginSize);
PlatformDefaults.setPanelInsets(marginValue, marginValue, marginValue, marginValue);
}
if (spacingSize != null) {
UnitValue spacingValue = new UnitValue(spacingSize);
PlatformDefaults.setGridCellGap(spacingValue, spacingValue);
}
}
示例3: getPixelUnitFactor
import net.miginfocom.layout.PlatformDefaults; //导入依赖的package包/类
public final float getPixelUnitFactor(boolean isHor) {
switch (PlatformDefaults.getLogicalPixelBase()) {
case PlatformDefaults.BASE_FONT_SIZE:
Font font = c.getFont();
FontMetrics fm = c.getFontMetrics(font != null ? font : SUBST_FONT);
Point.Float p = FM_MAP.get(fm);
if (p == null) {
Rectangle2D r = fm.getStringBounds("X", c.getGraphics());
p = new Point.Float(((float) r.getWidth()) / 6f, ((float) r.getHeight()) / 13.27734375f);
FM_MAP.put(fm, p);
}
return isHor ? p.x : p.y;
case PlatformDefaults.BASE_SCALE_FACTOR:
Float s = isHor ? PlatformDefaults.getHorizontalScaleFactor() : PlatformDefaults.getVerticalScaleFactor();
if (s != null)
return s;
return (isHor ? getHorizontalScreenDPI() : getVerticalScreenDPI())
/ (float) PlatformDefaults.getDefaultDPI();
default:
return 1f;
}
}
示例4: checkCache
import net.miginfocom.layout.PlatformDefaults; //导入依赖的package包/类
/**
* Check if something has changed and if so recreate it to the cached
* objects.
*
* @param parent
* The parent that is the target for this layout manager.
*/
private void checkCache(Object parent) {
if (parent == null) {
return;
}
checkConstrMap(parent);
ContainerWrapper par = checkParent(parent);
// Check if the grid is valid
int mc = PlatformDefaults.getModCount();
if (lastModCount != mc) {
grid = null;
lastModCount = mc;
}
int hash = parent instanceof ElementContainer<?, ?>
? Long.valueOf(((ElementContainer<?, ?>) parent).getLayoutCounter()).hashCode() : parent.hashCode();
for (ComponentWrapper cw : ccMap.keySet()) {
hash ^= cw.getLayoutHashCode();
hash += 285134905;
}
if (hash != lastHash) {
grid = null;
lastHash = hash;
}
setDebug(par, getDebugMillis() > 0);
if (grid == null) {
grid = new Grid(par, lc, rowSpecs, colSpecs, ccMap, callbackList);
}
}
示例5: getHorizontalScreenDPI
import net.miginfocom.layout.PlatformDefaults; //导入依赖的package包/类
public final int getHorizontalScreenDPI() {
// TODO
return PlatformDefaults.getDefaultDPI();
}
示例6: getVerticalScreenDPI
import net.miginfocom.layout.PlatformDefaults; //导入依赖的package包/类
public final int getVerticalScreenDPI() {
// TODO
return PlatformDefaults.getDefaultDPI();
}
示例7: getHorizontalScreenDPI
import net.miginfocom.layout.PlatformDefaults; //导入依赖的package包/类
public final int getHorizontalScreenDPI() {
return PlatformDefaults.getDefaultDPI();
}
示例8: getVerticalScreenDPI
import net.miginfocom.layout.PlatformDefaults; //导入依赖的package包/类
public final int getVerticalScreenDPI() {
return PlatformDefaults.getDefaultDPI();
}