本文整理匯總了Java中javax.swing.JScrollPane.getVerticalScrollBar方法的典型用法代碼示例。如果您正苦於以下問題:Java JScrollPane.getVerticalScrollBar方法的具體用法?Java JScrollPane.getVerticalScrollBar怎麽用?Java JScrollPane.getVerticalScrollBar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JScrollPane
的用法示例。
在下文中一共展示了JScrollPane.getVerticalScrollBar方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: componentMoved
import javax.swing.JScrollPane; //導入方法依賴的package包/類
@Override
public void componentMoved(ComponentEvent e) {
if(timer == null) {
JScrollPane scrollPane = getScrollPane();
if(scrollPane == null) {
change();
} else {
scrollBar = scrollPane.getVerticalScrollBar();
if(scrollBar == null ||
!scrollBar.getValueIsAdjusting()) {
// Try the horizontal scrollbar.
if((scrollBar = scrollPane.getHorizontalScrollBar())
!= null && scrollBar.getValueIsAdjusting()) {
startTimer();
} else {
change();
}
} else {
startTimer();
}
}
}
}
示例2: func_164247_a
import javax.swing.JScrollPane; //導入方法依賴的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);
}
}
}
示例3: scrollToTop
import javax.swing.JScrollPane; //導入方法依賴的package包/類
/**
* Scrolls scroll pane to the top left corner.
*/
public static void scrollToTop(final JScrollPane scrollPane) {
JScrollBar verticalScrollBar = scrollPane.getVerticalScrollBar();
JScrollBar horizontalScrollBar = scrollPane.getHorizontalScrollBar();
verticalScrollBar.setValue(verticalScrollBar.getMinimum());
horizontalScrollBar.setValue(horizontalScrollBar.getMinimum());
}
示例4: appendLine
import javax.swing.JScrollPane; //導入方法依賴的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);
}
}
}