本文整理汇总了Java中goryachev.fx.FxSize类的典型用法代码示例。如果您正苦于以下问题:Java FxSize类的具体用法?Java FxSize怎么用?Java FxSize使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FxSize类属于goryachev.fx包,在下文中一共展示了FxSize类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTextBounds
import goryachev.fx.FxSize; //导入依赖的package包/类
public static FxSize getTextBounds(TextArea t, double width)
{
String text = t.getText();
if(width < 0)
{
// Note that the wrapping width needs to be set to zero before
// getting the text's real preferred width.
helper.setWrappingWidth(0);
}
else
{
helper.setWrappingWidth(width);
}
helper.setText(text);
helper.setFont(t.getFont());
Bounds r = helper.getLayoutBounds();
Insets m = t.getInsets();
Insets p = t.getPadding();
double w = Math.ceil(r.getWidth() + m.getLeft() + m.getRight());
double h = Math.ceil(r.getHeight() + m.getTop() + m.getBottom());
return new FxSize(w, h);
}
示例2: computePrefWidth
import goryachev.fx.FxSize; //导入依赖的package包/类
@Override
protected double computePrefWidth(double height)
{
// return Double.MAX_VALUE;
// return super.computePrefWidth(height);
FxSize d = FX.getTextBounds(this, -1);
Insets insets = getInsets();
double w = Math.ceil(d.getWidth() + insets.getLeft() + insets.getRight());
return w;
}
示例3: computePrefHeight
import goryachev.fx.FxSize; //导入依赖的package包/类
@Override
protected double computePrefHeight(double width)
{
// return super.computePrefHeight(width);
FxSize d = FX.getTextBounds(this, width);
return d.getHeight();
}
示例4: sizeNode
import goryachev.fx.FxSize; //导入依赖的package包/类
protected void sizeNode(Node n)
{
if(n instanceof Region)
{
Region r = (Region)n;
data.put(n, new FxSize(r.getWidth(), r.getHeight()));
}
}