本文整理匯總了Java中javax.swing.BoundedRangeModel.setRangeProperties方法的典型用法代碼示例。如果您正苦於以下問題:Java BoundedRangeModel.setRangeProperties方法的具體用法?Java BoundedRangeModel.setRangeProperties怎麽用?Java BoundedRangeModel.setRangeProperties使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.BoundedRangeModel
的用法示例。
在下文中一共展示了BoundedRangeModel.setRangeProperties方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: apply
import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
private void apply (BoundedRangeModel src,
BoundedRangeModel tgt)
{
tgt.setRangeProperties(
src.getValue(),
src.getExtent(),
src.getMinimum(),
src.getMaximum(),
false);
}
示例2: getFieldViewAllocation
import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
public static final Shape getFieldViewAllocation(final View v,
final TextFieldKit tfk,
final Shape shape,
final ComponentOrientation
orientation) {
if (tfk == null || shape == null) {
return null;
}
Rectangle bounds = shape.getBounds();
int prefWidth = (int)v.getPreferredSpan(View.X_AXIS);
int height = (int)v.getPreferredSpan(View.Y_AXIS);
int diff = bounds.width - prefWidth;
int alignment = tfk.getHorizontalAlignment();
boolean toLeft = isToLeft(orientation, alignment);
int offset = 0;
if (alignment == SwingConstants.CENTER) {
offset = diff / 2;
} else {
offset = toLeft ? 0 : diff;
}
int extent = bounds.width - 1;
int max = Math.max(extent, prefWidth);
BoundedRangeModel brm = tfk.getHorizontalVisibility();
int value = Math.min(brm.getValue(), max - extent);
brm.setRangeProperties(value, extent, brm.getMinimum(), max, false);
int x = (diff < 0 ? -value + tfk.getInsets().left : bounds.x + offset);
int y = (bounds.height - height) / 2 + bounds.y;
if (!toLeft) {
x--;
}
return new Rectangle(x, y, prefWidth + 1, height);
}