当前位置: 首页>>代码示例>>Java>>正文


Java BoundedRangeModel.setValue方法代码示例

本文整理汇总了Java中javax.swing.BoundedRangeModel.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java BoundedRangeModel.setValue方法的具体用法?Java BoundedRangeModel.setValue怎么用?Java BoundedRangeModel.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.BoundedRangeModel的用法示例。


在下文中一共展示了BoundedRangeModel.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: maintainScrollBar

import javax.swing.BoundedRangeModel; //导入方法依赖的package包/类
/**
 *
 */
protected void maintainScrollBar(boolean horizontal, double factor,
		boolean center)
{
	JScrollBar scrollBar = (horizontal) ? getHorizontalScrollBar()
			: getVerticalScrollBar();

	if (scrollBar != null)
	{
		BoundedRangeModel model = scrollBar.getModel();
		int newValue = (int) Math.round(model.getValue() * factor)
				+ (int) Math.round((center) ? (model.getExtent()
						* (factor - 1) / 2) : 0);
		model.setValue(newValue);
	}
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:19,代码来源:mxGraphComponent.java

示例2: scrollRectToVisible

import javax.swing.BoundedRangeModel; //导入方法依赖的package包/类
/**
 * Horizontally scrolls text to make specified rectangle
 * visible. Uses bounded range model value for
 * scrolling. Repaints TextField.
 */
@Override
void scrollRectToVisible(Rectangle r) {
    final int x = r.x;
    final Insets insets = getTextFieldKit().getInsets();
    final BoundedRangeModel brm = getTextFieldKit().getHorizontalVisibility();
    final int oldValue = brm.getValue();
    final int width = getModelRect().width;
    if (x > width - insets.right) {
        final int newVal = oldValue + (x - width + insets.right) + 2;
        brm.setValue(newVal);
        repaint();
    }
    if (x < insets.left) {
        brm.setValue(oldValue - (insets.left - x) - 2);
        repaint();
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:23,代码来源:TextField.java

示例3: scrollRectToVisible

import javax.swing.BoundedRangeModel; //导入方法依赖的package包/类
/**
 * Horizontally scrolls text to make specified rectangle
 * visible. Uses bounded range model value for
 * scrolling. Repaints TextField.
 */
@Override
void scrollRectToVisible(Rectangle r) {
    int x = r.x;
    Insets insets = getTextFieldKit().getInsets();
    BoundedRangeModel brm = getTextFieldKit().getHorizontalVisibility();
    int oldValue = brm.getValue();
    int width = getModelRect().width;
    if (x > width - insets.right) {
        int newVal = oldValue + (x - width + insets.right) + 2;
        brm.setValue(newVal);
        repaint();
    }
    if (x < insets.left) {
        brm.setValue(oldValue - (insets.left - x) - 2);
        repaint();
    }
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:23,代码来源:TextField.java

示例4: componentResized

import javax.swing.BoundedRangeModel; //导入方法依赖的package包/类
@Override
     public void componentResized(ComponentEvent event) {
boolean adjustViewportToBottom = false;

BoundedRangeModel model = scrollBar.getModel();
if ((model.getValue() == model.getMaximum() - model.getExtent())
		|| model.getExtent() >= model.getMaximum()) {
	adjustViewportToBottom = true;
}

model.setExtent(viewport.getHeight());
model.setMaximum(viewport.getView().getHeight());

if (adjustViewportToBottom || !isActive) {
	model.setValue(viewport.getView().getHeight() - viewport.getHeight());
}
     }
 
开发者ID:georgy,项目名称:gmc,代码行数:18,代码来源:SplitTextPane.java

示例5: setValue

import javax.swing.BoundedRangeModel; //导入方法依赖的package包/类
private static void setValue(final BoundedRangeModel model, final int val) {
    if (SwingUtilities.isEventDispatchThread()) {
        model.setValue(val);
    } else {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() { model.setValue(val); }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:HeapProgress.java

示例6: scrollToCenter

import javax.swing.BoundedRangeModel; //导入方法依赖的package包/类
/**
 * 
 */
public void scrollToCenter(boolean horizontal)
{
	JScrollBar scrollBar = (horizontal) ? getHorizontalScrollBar()
			: getVerticalScrollBar();

	if (scrollBar != null)
	{
		final BoundedRangeModel model = scrollBar.getModel();
		final int newValue = ((model.getMaximum()) / 2) - model.getExtent()
				/ 2;
		model.setValue(newValue);
	}
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:17,代码来源:mxGraphComponent.java

示例7: maintainScrollBar

import javax.swing.BoundedRangeModel; //导入方法依赖的package包/类
/**
 *
 */
protected void maintainScrollBar(boolean horizontal, double factor, boolean center) {
  JScrollBar scrollBar = (horizontal) ? getHorizontalScrollBar() : getVerticalScrollBar();

  if (scrollBar != null) {
    BoundedRangeModel model = scrollBar.getModel();
    int newValue = (int) Math.round(model.getValue() * factor)
        + (int) Math.round((center) ? (model.getExtent() * (factor - 1) / 2) : 0);
    model.setValue(newValue);
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:14,代码来源:mxGraphComponent.java

示例8: scrollToCenter

import javax.swing.BoundedRangeModel; //导入方法依赖的package包/类
/**
 * 
 */
public void scrollToCenter(boolean horizontal) {
  JScrollBar scrollBar = (horizontal) ? getHorizontalScrollBar() : getVerticalScrollBar();

  if (scrollBar != null) {
    final BoundedRangeModel model = scrollBar.getModel();
    final int newValue = ((model.getMaximum()) / 2) - model.getExtent() / 2;
    model.setValue(newValue);
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:13,代码来源:mxGraphComponent.java

示例9: maintainScrollBar

import javax.swing.BoundedRangeModel; //导入方法依赖的package包/类
/**
 *
 */
protected void maintainScrollBar(boolean horizontal, double factor, boolean center) {
	JScrollBar scrollBar = (horizontal) ? getHorizontalScrollBar() : getVerticalScrollBar();

	if (scrollBar != null) {
		BoundedRangeModel model = scrollBar.getModel();
		int newValue = (int) Math.round(model.getValue() * factor)
				+ (int) Math.round((center) ? (model.getExtent() * (factor - 1) / 2) : 0);
		model.setValue(newValue);
	}
}
 
开发者ID:md-k-sarker,项目名称:OWLAx,代码行数:14,代码来源:mxGraphComponent.java

示例10: scrollToCenter

import javax.swing.BoundedRangeModel; //导入方法依赖的package包/类
/**
 * 
 */
public void scrollToCenter(boolean horizontal) {
	JScrollBar scrollBar = (horizontal) ? getHorizontalScrollBar() : getVerticalScrollBar();

	if (scrollBar != null) {
		final BoundedRangeModel model = scrollBar.getModel();
		final int newValue = ((model.getMaximum()) / 2) - model.getExtent() / 2;
		model.setValue(newValue);
	}
}
 
开发者ID:md-k-sarker,项目名称:OWLAx,代码行数:13,代码来源:mxGraphComponent.java

示例11: clear

import javax.swing.BoundedRangeModel; //导入方法依赖的package包/类
public void clear() {
	BoundedRangeModel progressModel = progressBar.getModel();
	progressModel.setValue(0);
	progressModel.setMinimum(0);
	progressModel.setMaximum(0);
	progressBar.setString("");
}
 
开发者ID:link-intersystems,项目名称:GitDirStat,代码行数:8,代码来源:ProgressBarMonitor.java

示例12: addMessage

import javax.swing.BoundedRangeModel; //导入方法依赖的package包/类
/** thread safe. */
public void addMessage(final String message) {
  final Runnable runner = () -> {
    try {
      final Document doc = text.getDocument();
      // save history entry
      final IEditDelegate delegate = frame.getEditDelegate();
      final String error;
      if (delegate == null) {
        error = "You can only add comments during your turn";
      } else {
        error = delegate.addComment(message);
      }
      if (error != null) {
        doc.insertString(doc.getLength(), error + "\n", italic);
      }
    } catch (final BadLocationException e) {
      ClientLogger.logQuietly(e);
    }
    final BoundedRangeModel scrollModel = scrollPane.getVerticalScrollBar().getModel();
    scrollModel.setValue(scrollModel.getMaximum());
  };
  // invoke in the swing event thread
  if (SwingUtilities.isEventDispatchThread()) {
    runner.run();
  } else {
    SwingUtilities.invokeLater(runner);
  }
}
 
开发者ID:triplea-game,项目名称:triplea,代码行数:30,代码来源:CommentPanel.java

示例13: mouseDragged

import javax.swing.BoundedRangeModel; //导入方法依赖的package包/类
public void mouseDragged(MouseEvent e) {
    if (p == null) {
        //do nothing
    } else {
        BoundedRangeModel hModel = scrollPane.getHorizontalModel();
        BoundedRangeModel vModel = scrollPane.getVerticalModel();
        hModel.setValue(hModel.getValue() + (p.x - e.getX()));
        vModel.setValue(vModel.getValue() + (p.y - e.getY()));
    }
}
 
开发者ID:heqichen,项目名称:openblocks,代码行数:11,代码来源:BlockCanvas.java

示例14: setValueOnDragging

import javax.swing.BoundedRangeModel; //导入方法依赖的package包/类
void setValueOnDragging(final MouseEvent e, final int currentMouseX, final int currentMouseY, final int initialModelValue) {
    BoundedRangeModel model = scrollbar.getModel();
    int extent = model.getExtent();
    int viewSize = model.getMaximum() - model.getMinimum();
    int availableScrollingSize = viewSize - extent;
    int thumbSize = getThumbSize(Math.round(getTrackSize() * extent / viewSize));
    int availableTrackSize = getTrackSize() - thumbSize;
    int offset = getOffset(e, currentMouseX, currentMouseY);
    int modelIncrement = availableTrackSize != 0 ? offset * availableScrollingSize / availableTrackSize : 0;
    model.setValue(initialModelValue + modelIncrement);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:BasicScrollBarUI.java

示例15: updateScrollbar

import javax.swing.BoundedRangeModel; //导入方法依赖的package包/类
private void updateScrollbar() {
    if (null == scrollBar) {
        return;
    }
    if (null == model || model.getSize() == 0) {
        internalScrollbarValueIsAdjusting = true;
        scrollBar.getModel().setRangeProperties(0, 0, 0, 0, false);
        internalScrollbarValueIsAdjusting = false;
        scrollBar.setEnabled(false);
        return;
    }
    if (! scrollBar.isEnabled()) {
        scrollBar.setEnabled(true);
    }
    int size = model.getSize();
    int firstDispIdx = getFirstDisplayedIdx();
    int displayedCount = getRowCount() * getColumnCount();
    int lastDispIdx = firstDispIdx + displayedCount - 1;
    if (lastDispIdx >= size) {
        lastDispIdx = size - 1;
    }
    BoundedRangeModel scrollModel = scrollBar.getModel();
    internalScrollbarValueIsAdjusting = true;
    scrollModel.setMinimum(0);
    scrollModel.setMaximum(size - 1);
    scrollModel.setValue(firstDispIdx);
    scrollModel.setExtent(displayedCount - 1);
    internalScrollbarValueIsAdjusting = false;
    scrollBar.setUnitIncrement(getColumnCount());
    scrollBar.setBlockIncrement(displayedCount);
}
 
开发者ID:Sofd,项目名称:sofd_swing,代码行数:32,代码来源:JGridList.java


注:本文中的javax.swing.BoundedRangeModel.setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。