本文整理汇总了Java中javax.swing.JScrollBar.getMaximum方法的典型用法代码示例。如果您正苦于以下问题:Java JScrollBar.getMaximum方法的具体用法?Java JScrollBar.getMaximum怎么用?Java JScrollBar.getMaximum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JScrollBar
的用法示例。
在下文中一共展示了JScrollBar.getMaximum方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adjustmentValueChanged
import javax.swing.JScrollBar; //导入方法依赖的package包/类
/**
* Listens to changes of the scroll bar of the text are showing the EULA text, enables the check
* box once the user scrolled to the end of the document.
*/
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
JScrollBar scrollBar = this.scrollPane.getVerticalScrollBar();
if (e.getSource() == scrollBar) {
// the maximum value of the scroll bar assumes that the content is
// not visible anymore, since this is not the case when scrolling
// to the end of the document (the last part is still visible),
// we have to include the visible amount in the comparison
int currentValue = scrollBar.getValue() + scrollBar.getVisibleAmount();
if (currentValue >= scrollBar.getMaximum()) {
// the user scrolled to the end of the document
this.acceptCheckBox.setEnabled(true);
this.acceptCheckBox.requestFocusInWindow();
}
}
}
示例2: print
import javax.swing.JScrollBar; //导入方法依赖的package包/类
public void print(String string) {
System.out.print(string);
Document document = this.textArea.getDocument();
final JScrollBar scrollBar = this.scrollPane.getVerticalScrollBar();
boolean shouldScroll = (scrollBar.getValue() + scrollBar.getSize().getHeight() +
MONOSPACED.getSize() * 2 > scrollBar.getMaximum());
try {
document.insertString(document.getLength(), string, null);
} catch (BadLocationException ignored) {
}
if (shouldScroll) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
scrollBar.setValue(2147483647);
}
});
}
}
示例3: appendText
import javax.swing.JScrollBar; //导入方法依赖的package包/类
public void appendText(final String str) {
if (!EventQueue.isDispatchThread()) {
throw new IllegalStateException("Method must be called on EDT!");
}
final JScrollBar scrollBar;
JScrollPane scrollPane = (JScrollPane) SwingUtilities.getAncestorOfClass(JScrollPane.class, this);
if (scrollPane == null) {
scrollBar = null;
} else {
JScrollBar sb = scrollPane.getHorizontalScrollBar();
if (sb.getValue() + SCROLL_THRESHOLD >= sb.getMaximum()) {
scrollBar = sb;
} else {
scrollBar = null;
}
}
append(str);
if (scrollBar != null) {
scrollBar.setValue(scrollBar.getMaximum());
}
}
示例4: validateThird
import javax.swing.JScrollBar; //导入方法依赖的package包/类
public void validateThird() {
JViewport viewport = this.pane.getViewport();
JScrollBar scroller = this.pane.getHorizontalScrollBar();
if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) {
throw new Error("unexpected component orientation");
}
int value = scroller.getValue();
if (value != 0) {
throw new Error("unexpected scroll value");
}
int extent = viewport.getExtentSize().width;
if (extent != scroller.getVisibleAmount()) {
throw new Error("unexpected visible amount");
}
int size = viewport.getViewSize().width;
if (size != scroller.getMaximum()) {
throw new Error("unexpected maximum");
}
int pos = size - extent - value;
if (pos != viewport.getViewPosition().x) {
throw new Error("unexpected position");
}
}
示例5: func_164247_a
import javax.swing.JScrollBar; //导入方法依赖的package包/类
public void func_164247_a(final JTextArea p_164247_1_, final JScrollPane p_164247_2_, final String p_164247_3_)
{
if (!SwingUtilities.isEventDispatchThread())
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
MinecraftServerGui.this.func_164247_a(p_164247_1_, p_164247_2_, p_164247_3_);
}
});
}
else
{
Document document = p_164247_1_.getDocument();
JScrollBar jscrollbar = p_164247_2_.getVerticalScrollBar();
boolean flag = false;
if (p_164247_2_.getViewport().getView() == p_164247_1_)
{
flag = (double)jscrollbar.getValue() + jscrollbar.getSize().getHeight() + (double)(serverGuiFont.getSize() * 4) > (double)jscrollbar.getMaximum();
}
try
{
document.insertString(document.getLength(), p_164247_3_, (AttributeSet)null);
}
catch (BadLocationException var8)
{
;
}
if (flag)
{
jscrollbar.setValue(Integer.MAX_VALUE);
}
}
}
示例6: mouseReleased
import javax.swing.JScrollBar; //导入方法依赖的package包/类
public void mouseReleased(MouseEvent e)
{
if (start != null)
{
if (zoomGesture)
{
double dx = e.getX() - start.getX();
double w = finderBounds.getWidth();
final JScrollBar hs = graphComponent
.getHorizontalScrollBar();
final double sx;
if (hs != null)
{
sx = (double) hs.getValue() / hs.getMaximum();
}
else
{
sx = 0;
}
final JScrollBar vs = graphComponent.getVerticalScrollBar();
final double sy;
if (vs != null)
{
sy = (double) vs.getValue() / vs.getMaximum();
}
else
{
sy = 0;
}
mxGraphView view = graphComponent.getGraph().getView();
double scale = view.getScale();
double newScale = scale - (dx * scale) / w;
double factor = newScale / scale;
view.setScale(newScale);
if (hs != null)
{
hs.setValue((int) (sx * hs.getMaximum() * factor));
}
if (vs != null)
{
vs.setValue((int) (sy * vs.getMaximum() * factor));
}
}
zoomGesture = false;
start = null;
}
}
示例7: mouseReleased
import javax.swing.JScrollBar; //导入方法依赖的package包/类
public void mouseReleased(MouseEvent e) {
if (start != null) {
if (zoomGesture) {
double dx = e.getX() - start.getX();
double w = finderBounds.getWidth();
final JScrollBar hs = graphComponent.getHorizontalScrollBar();
final double sx;
if (hs != null) {
sx = (double) hs.getValue() / hs.getMaximum();
} else {
sx = 0;
}
final JScrollBar vs = graphComponent.getVerticalScrollBar();
final double sy;
if (vs != null) {
sy = (double) vs.getValue() / vs.getMaximum();
} else {
sy = 0;
}
mxGraphView view = graphComponent.getGraph().getView();
double scale = view.getScale();
double newScale = scale - (dx * scale) / w;
double factor = newScale / scale;
view.setScale(newScale);
if (hs != null) {
hs.setValue((int) (sx * hs.getMaximum() * factor));
}
if (vs != null) {
vs.setValue((int) (sy * vs.getMaximum() * factor));
}
}
zoomGesture = false;
start = null;
}
}
示例8: appendLine
import javax.swing.JScrollBar; //导入方法依赖的package包/类
public void appendLine(final JTextArea textArea, final JScrollPane scrollPane, final String line)
{
try
{
latch.await();
} catch (InterruptedException e){} //Prevent logging until after constructor has ended.
if (!SwingUtilities.isEventDispatchThread())
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
MinecraftServerGui.this.appendLine(textArea, scrollPane, line);
}
});
}
else
{
Document document = textArea.getDocument();
JScrollBar jscrollbar = scrollPane.getVerticalScrollBar();
boolean flag = false;
if (scrollPane.getViewport().getView() == textArea)
{
flag = (double)jscrollbar.getValue() + jscrollbar.getSize().getHeight() + (double)(SERVER_GUI_FONT.getSize() * 4) > (double)jscrollbar.getMaximum();
}
try
{
document.insertString(document.getLength(), line, (AttributeSet)null);
}
catch (BadLocationException var8)
{
;
}
if (flag)
{
jscrollbar.setValue(Integer.MAX_VALUE);
}
}
}