當前位置: 首頁>>代碼示例>>Java>>正文


Java JScrollBar.getMaximum方法代碼示例

本文整理匯總了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();
		}
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:21,代碼來源:EULADialog.java

示例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);
			}
		});
	}
}
 
開發者ID:DivergenceBot,項目名稱:Bootstrapper,代碼行數:24,代碼來源:Bootstrapper.java

示例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());
    }
}
 
開發者ID:pascalgn,項目名稱:jiracli,代碼行數:23,代碼來源:ConsoleTextArea.java

示例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");
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:24,代碼來源:Test6526631.java

示例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);
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:39,代碼來源:MinecraftServerGui.java

示例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;
	}
}
 
開發者ID:GDSRS,項目名稱:TrabalhoFinalEDA2,代碼行數:56,代碼來源:mxGraphOutline.java

示例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;
  }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:44,代碼來源:mxGraphOutline.java

示例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);
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:43,代碼來源:MinecraftServerGui.java


注:本文中的javax.swing.JScrollBar.getMaximum方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。