javax.swing.JTextField.getHorizontalVisibility()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中javax.swing.JTextField.getHorizontalVisibility()方法的一些代码示例,展示了JTextField.getHorizontalVisibility()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextField.getHorizontalVisibility()方法的具体详情如下:
包路径:javax.swing.JTextField
类名称:JTextField
方法名:getHorizontalVisibility

JTextField.getHorizontalVisibility介绍

暂无

代码示例

代码示例来源:origin: org.tentackle/tentackle-swing

/**
 * Update the visibility model with the associated JTextField
 * (if there is one) to reflect the current visibility as a
 * result of changes to the document model.  The bounded
 * range properties are updated.  If the view hasn't yet been
 * shown the extent will be zero and we just set it to be full
 * until determined otherwise.
 */
void updateVisibilityModel() {
 Component c = getContainer();
 if (c instanceof JTextField) {
  JTextField field = (JTextField) c;
  BoundedRangeModel vis = field.getHorizontalVisibility();
  int hspan = (int) getPreferredSpan(X_AXIS);
  int extent = vis.getExtent();
  int maximum = Math.max(hspan, extent);
  extent = (extent == 0) ? maximum : extent;
  int value = maximum - extent;
  int oldValue = vis.getValue();
  if ((oldValue + extent) > maximum) {
   oldValue = maximum - extent;
  }
  value = Math.max(0, Math.min(value, oldValue));
  vis.setRangeProperties(value, extent, 0, maximum, false);
 }
}

代码示例来源:origin: stackoverflow.com

final JTextField textField = new JTextField(TEXT);
JScrollBar scroller = new JScrollBar(JScrollBar.HORIZONTAL);
scroller.setModel(textField.getHorizontalVisibility());

代码示例来源:origin: stackoverflow.com

scroller.setModel(textField.getHorizontalVisibility());

代码示例来源:origin: org.tentackle/tentackle-swing

if (c instanceof JTextField) {
 JTextField field = (JTextField) c;
 BoundedRangeModel vis = field.getHorizontalVisibility();
 int max = Math.max(hspan, bounds.width);
 int value = vis.getValue();

相关文章

JTextField类方法