本文整理匯總了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()));
}
}